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
This commit is contained in:
jonjenssen 2022-01-13 09:02:07 +01:00 committed by GitHub
parent dc31a731ad
commit 9d4b7422e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 502 additions and 21 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

View File

@ -240,6 +240,7 @@
<file>ComboBoxDown.svg</file>
<file>ComboBoxUp.svg</file>
<file>WellIntAnalysis.png</file>
<file>DataVector.png</file>
</qresource>
<qresource prefix="/Shader">
<file>fs_CellFace.glsl</file>

View File

@ -61,6 +61,7 @@ void RicReloadSummaryCaseFeature::onActionTriggered( bool isChecked )
{
summaryCase->createSummaryReaderInterface();
summaryCase->createRftReaderInterface();
summaryCase->refreshMetaData();
RicReplaceSummaryCaseFeature::updateRequredCalculatedCurves( summaryCase );

View File

@ -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 );

View File

@ -347,7 +347,7 @@ void RimMainPlotCollection::ensureCalculationIdsAreAssigned()
for ( RimSummaryAddress* adr : allAddresses )
{
adr->ensureIdIsAssigned();
adr->ensureCalculationIdIsAssigned();
}
}

View File

@ -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})

View File

@ -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;
}

View File

@ -44,26 +44,44 @@ public:
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<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>> m_category;
caf::PdmField<QString> m_quantityName;
caf::PdmField<int> m_regionNumber;
caf::PdmField<int> m_regionNumber2;
caf::PdmField<QString> m_wellGroupName;
caf::PdmField<QString> m_wellName;
caf::PdmField<int> m_wellSegmentNumber;
caf::PdmField<QString> m_lgrName;
caf::PdmField<int> m_cellI;
caf::PdmField<int> m_cellJ;
caf::PdmField<int> m_cellK;
caf::PdmField<int> m_aquiferNumber;
caf::PdmField<bool> m_isErrorResult;
caf::PdmField<int> m_calculationId;
caf::PdmField<QString> m_quantityName;
caf::PdmField<int> m_regionNumber;
caf::PdmField<int> m_regionNumber2;
caf::PdmField<QString> m_wellGroupName;
caf::PdmField<QString> m_wellName;
caf::PdmField<int> m_wellSegmentNumber;
caf::PdmField<QString> m_lgrName;
caf::PdmField<int> m_cellI;
caf::PdmField<int> m_cellJ;
caf::PdmField<int> m_cellK;
caf::PdmField<int> m_aquiferNumber;
caf::PdmField<bool> m_isErrorResult;
caf::PdmField<int> m_calculationId;
caf::PdmField<int> m_caseId;
caf::PdmField<int> m_ensembleId;
};

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// 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<RifEclipseSummaryAddress>& 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 );
}
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimNamedObject.h"
#include "cafPdmChildArrayField.h"
#include <QString>
#include <string>
#include <vector>
class RimSummaryAddress;
class RifEclipseSummaryAddress;
class RimSummaryAddressCollection : public RimNamedObject
{
CAF_PDM_HEADER_INIT;
public:
RimSummaryAddressCollection();
~RimSummaryAddressCollection() override;
void updateFolderStructure( const std::set<RifEclipseSummaryAddress>& 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<RimSummaryAddress*> m_adresses;
caf::PdmChildArrayField<RimSummaryAddressCollection*> m_subfolders;
};

View File

@ -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<caf::PdmAbstractFieldScriptingCapability>()->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();
}

View File

@ -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 @@ public:
void updateAutoShortName();
void updateOptionSensitivity();
void refreshMetaData();
virtual void createSummaryReaderInterface() = 0;
virtual void createRftReaderInterface() {}
virtual RifSummaryReaderInterface* summaryReader() = 0;
@ -93,11 +98,15 @@ private:
static QString uniqueShortNameForEnsembleCase( RimSummaryCase* summaryCase );
static QString uniqueShortNameForSummaryCase( RimSummaryCase* summaryCase );
void buildChildNodes();
protected:
caf::PdmField<QString> m_displayName;
caf::PdmField<DisplayNameEnum> m_displayNameOption;
caf::PdmField<caf::FilePath> m_summaryHeaderFilename;
caf::PdmChildField<RimSummaryAddressCollection*> m_dataVectorFolders;
bool m_isObservedData;
caf::PdmField<int> m_caseId;

View File

@ -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 <QFileInfo>
@ -124,6 +126,13 @@ RimSummaryCaseCollection::RimSummaryCaseCollection()
m_ensembleId.uiCapability()->setUiReadOnly( true );
m_ensembleId.capability<caf::PdmAbstractFieldScriptingCapability>()->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<RimDerivedSummaryCase*>( 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();
}

View File

@ -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 @@ public:
RiaDefines::EclipseUnitSystem unitSystem() const;
void refreshMetaData();
private:
RigEnsembleParameter createEnsembleParameter( const QString& paramName ) const;
static void sortByBinnedVariation( std::vector<RigEnsembleParameter>& parameterVector );
@ -114,18 +118,22 @@ private:
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<RimSummaryCase*> m_cases;
private:
caf::PdmField<QString> m_name;
caf::PdmProxyValueField<QString> m_nameAndItemCount;
caf::PdmField<bool> m_isEnsemble;
caf::PdmField<QString> m_name;
caf::PdmProxyValueField<QString> m_nameAndItemCount;
caf::PdmField<bool> m_isEnsemble;
caf::PdmChildField<RimSummaryAddressCollection*> m_dataVectorFolders;
cvf::ref<RifReaderEnsembleStatisticsRft> m_statisticsEclipseRftReader;
caf::PdmField<int> m_ensembleId;

View File

@ -628,6 +628,7 @@ std::vector<RimSummaryCase*> RimSummaryCaseMainCollection::createSummaryCasesFro
newSumCase->setAssociatedEclipseCase( eclCase );
newSumCase->updateOptionSensitivity();
project->assignCaseIdToSummaryCase( newSumCase );
newSumCase->refreshMetaData();
sumCases.push_back( newSumCase );
}
else
@ -644,6 +645,7 @@ std::vector<RimSummaryCase*> RimSummaryCaseMainCollection::createSummaryCasesFro
newSumCase->setSummaryHeaderFileName( fileInfo.summaryFileName() );
newSumCase->updateOptionSensitivity();
project->assignCaseIdToSummaryCase( newSumCase );
newSumCase->refreshMetaData();
sumCases.push_back( newSumCase );
}

View File

@ -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<RimEclipseCase*>( uiItem ) || dynamic_cast<RimWellLogCurve*>( uiItem ) ||
dynamic_cast<RimWellLogFileChannel*>( uiItem ) || dynamic_cast<RimPlot*>( uiItem ) ||
dynamic_cast<RimSummaryCase*>( uiItem ) || dynamic_cast<RimSummaryCurve*>( uiItem ) ||
dynamic_cast<RimSurface*>( uiItem ) )
dynamic_cast<RimSurface*>( uiItem ) || dynamic_cast<RimSummaryAddress*>( uiItem ) )
{
// TODO: Remember to handle reservoir holding the main grid
itemflags |= Qt::ItemIsDragEnabled;