mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-26 21:27:15 -05:00
#14101 Add Data Analytics PDM folder with right-click creation
Replace the transient Data Analytics tree label with a real RimDataAnalyticsCollection object that owns the case-level fault distance collection and the well target mappings. The folder shows its analytics objects flattened and exposes a right-click menu to create a new Fault Distance and a new Well Target Mapping. Migrate case-level well target mappings from older project files into the new collection via initAfterRead; fault distance is unreleased and needs no migration. The case accessors faultDistanceCollection() and addWellTargetMapping() now forward to the new object, and the creation features resolve a selected Data Analytics folder.
This commit is contained in:
committed by
Magne Sjaastad
parent
6681ba566f
commit
12cd173c62
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "RicNewFaultDistanceResultFeature.h"
|
||||
|
||||
#include "RimDataAnalyticsCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFaultDistance.h"
|
||||
@@ -49,6 +50,9 @@ RimEclipseView* findHostView()
|
||||
const auto faultCollections = caf::SelectionManager::instance()->objectsByType<RimFaultInViewCollection>();
|
||||
if ( !faultCollections.empty() ) return faultCollections.front()->firstAncestorOrThisOfType<RimEclipseView>();
|
||||
|
||||
const auto analyticsCollections = caf::SelectionManager::instance()->objectsByType<RimDataAnalyticsCollection>();
|
||||
if ( !analyticsCollections.empty() ) return firstViewOfCase( analyticsCollections.front() );
|
||||
|
||||
const auto distanceCollections = caf::SelectionManager::instance()->objectsByType<RimFaultDistanceCollection>();
|
||||
if ( !distanceCollections.empty() ) return firstViewOfCase( distanceCollections.front() );
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "RicNewWellTargetMappingFeature.h"
|
||||
|
||||
#include "RimDataAnalyticsCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCaseEnsemble.h"
|
||||
#include "RimReservoirGridEnsemble.h"
|
||||
@@ -84,6 +85,18 @@ void RicNewWellTargetMappingFeature::onActionTriggered( bool isChecked )
|
||||
eclipseCase->addWellTargetMapping( wellTargetMapping );
|
||||
wellTargetMapping->setDefaults();
|
||||
|
||||
eclipseCase->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( wellTargetMapping );
|
||||
}
|
||||
else if ( auto collections = caf::selectedObjectsByTypeStrict<RimDataAnalyticsCollection*>(); !collections.empty() )
|
||||
{
|
||||
auto eclipseCase = collections.front()->firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
if ( !eclipseCase ) return;
|
||||
|
||||
auto wellTargetMapping = new RimWellTargetMapping();
|
||||
eclipseCase->addWellTargetMapping( wellTargetMapping );
|
||||
wellTargetMapping->setDefaults();
|
||||
|
||||
eclipseCase->updateConnectedEditors();
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( wellTargetMapping );
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimOilField.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimProject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDataAnalyticsCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimIdenticalGridCaseGroup.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseInputProperty.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseInputPropertyCollection.cpp
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2026- 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 "RimDataAnalyticsCollection.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimFaultDistance.h"
|
||||
#include "RimFaultDistanceCollection.h"
|
||||
#include "RimWellTargetMapping.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimDataAnalyticsCollection, "DataAnalyticsCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDataAnalyticsCollection::RimDataAnalyticsCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Data Analytics", ":/Folder.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_faultDistanceCollection, "FaultDistanceCollection", "Fault Distance" );
|
||||
m_faultDistanceCollection = new RimFaultDistanceCollection;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellTargetMappings, "WellTargetMappings", "Well Target Mappings" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultDistanceCollection* RimDataAnalyticsCollection::faultDistanceCollection() const
|
||||
{
|
||||
return m_faultDistanceCollection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDataAnalyticsCollection::addWellTargetMapping( RimWellTargetMapping* wellTargetMapping )
|
||||
{
|
||||
m_wellTargetMappings.push_back( wellTargetMapping );
|
||||
wellTargetMapping->updateResultDefinition();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellTargetMapping*> RimDataAnalyticsCollection::wellTargetMappings() const
|
||||
{
|
||||
return m_wellTargetMappings.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimDataAnalyticsCollection::isEmpty() const
|
||||
{
|
||||
const bool hasFaultDistance = m_faultDistanceCollection() && !m_faultDistanceCollection()->isEmpty();
|
||||
return !hasFaultDistance && m_wellTargetMappings.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Show the analytics objects flattened directly under this folder (no intermediate collection node).
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDataAnalyticsCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
|
||||
{
|
||||
if ( m_faultDistanceCollection() )
|
||||
{
|
||||
for ( auto* result : m_faultDistanceCollection()->items() )
|
||||
{
|
||||
uiTreeOrdering.add( result );
|
||||
}
|
||||
}
|
||||
|
||||
for ( RimWellTargetMapping* wellTargetMapping : m_wellTargetMappings )
|
||||
{
|
||||
uiTreeOrdering.add( wellTargetMapping );
|
||||
}
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDataAnalyticsCollection::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const
|
||||
{
|
||||
menuBuilder << "RicNewFaultDistanceResultFeature";
|
||||
menuBuilder << "RicNewWellTargetMappingFeature";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// The case-level "Data Analytics" folder is hidden from the tree while empty, so refresh the owner
|
||||
/// case to re-run its defineUiTreeOrdering and remove the folder when the last item is removed.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDataAnalyticsCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
updateConnectedEditors();
|
||||
|
||||
if ( auto* eclipseCase = firstAncestorOrThisOfType<RimEclipseCase>() ) eclipseCase->updateConnectedEditors();
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2026- 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 "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimFaultDistanceCollection;
|
||||
class RimWellTargetMapping;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class CmdFeatureMenuBuilder;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
/// Case-level "Data Analytics" folder. Owns the analytics objects (fault distance results and
|
||||
/// well target mappings) and exposes a right-click menu for creating new ones.
|
||||
//==================================================================================================
|
||||
class RimDataAnalyticsCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimDataAnalyticsCollection();
|
||||
|
||||
RimFaultDistanceCollection* faultDistanceCollection() const;
|
||||
|
||||
void addWellTargetMapping( RimWellTargetMapping* wellTargetMapping );
|
||||
std::vector<RimWellTargetMapping*> wellTargetMappings() const;
|
||||
|
||||
bool isEmpty() const;
|
||||
|
||||
private:
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimFaultDistanceCollection*> m_faultDistanceCollection;
|
||||
caf::PdmChildArrayField<RimWellTargetMapping*> m_wellTargetMappings;
|
||||
};
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "Rim2dIntersectionViewCollection.h"
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimDataAnalyticsCollection.h"
|
||||
#include "RimDataFilterCollection.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseInputProperty.h"
|
||||
@@ -132,10 +133,13 @@ RimEclipseCase::RimEclipseCase()
|
||||
m_dataFilterCollection = new RimDataFilterCollection;
|
||||
m_dataFilterCollection->setCase( this );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellTargetMappings, "WellTargetMappings", "Well Target Mappings" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_dataAnalyticsCollection, "DataAnalyticsCollection", "Data Analytics" );
|
||||
m_dataAnalyticsCollection = new RimDataAnalyticsCollection;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_faultDistanceCollection, "FaultDistanceCollection", "Fault Distance" );
|
||||
m_faultDistanceCollection = new RimFaultDistanceCollection;
|
||||
// Obsolete: well target mappings used to be stored directly on the case. They are migrated into
|
||||
// the Data Analytics collection in initAfterRead().
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellTargetMappings_OBSOLETE, "WellTargetMappings", "Well Target Mappings" );
|
||||
m_wellTargetMappings_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_resultAliasList, "ResultAliasNames", "Result Name Aliases" );
|
||||
m_resultAliasList.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() );
|
||||
@@ -316,6 +320,14 @@ void RimEclipseCase::initAfterRead()
|
||||
|
||||
m_contourMapCollection_OBSOLETE->clearWithoutDelete();
|
||||
|
||||
// Move case-level well target mappings into the Data Analytics collection.
|
||||
for ( RimWellTargetMapping* wellTargetMapping : m_wellTargetMappings_OBSOLETE.childrenByType() )
|
||||
{
|
||||
m_wellTargetMappings_OBSOLETE.removeChild( wellTargetMapping );
|
||||
m_dataAnalyticsCollection->addWellTargetMapping( wellTargetMapping );
|
||||
}
|
||||
m_wellTargetMappings_OBSOLETE.clearWithoutDelete();
|
||||
|
||||
m_dataFilterCollection()->setCase( this );
|
||||
}
|
||||
|
||||
@@ -671,24 +683,9 @@ void RimEclipseCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
|
||||
{
|
||||
if ( uiConfigName == "MainWindow.ProjectTree" )
|
||||
{
|
||||
const bool hasFaultDistance = m_faultDistanceCollection() && !m_faultDistanceCollection()->isEmpty();
|
||||
const bool hasWellTargets = !m_wellTargetMappings.empty();
|
||||
if ( hasFaultDistance || hasWellTargets )
|
||||
if ( m_dataAnalyticsCollection() && !m_dataAnalyticsCollection()->isEmpty() )
|
||||
{
|
||||
auto* dataAnalytics = uiTreeOrdering.add( "Data Analytics", ":/Folder.png" );
|
||||
|
||||
if ( hasFaultDistance )
|
||||
{
|
||||
for ( auto* result : m_faultDistanceCollection()->items() )
|
||||
{
|
||||
dataAnalytics->add( result );
|
||||
}
|
||||
}
|
||||
|
||||
for ( RimWellTargetMapping* wellTargetMapping : m_wellTargetMappings )
|
||||
{
|
||||
dataAnalytics->add( wellTargetMapping );
|
||||
}
|
||||
uiTreeOrdering.add( m_dataAnalyticsCollection() );
|
||||
}
|
||||
|
||||
for ( auto view : m_viewCollection->views() )
|
||||
@@ -1452,8 +1449,7 @@ std::vector<RimEclipseContourMapView*> RimEclipseCase::contourMapViews() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseCase::addWellTargetMapping( RimWellTargetMapping* generator )
|
||||
{
|
||||
m_wellTargetMappings.push_back( generator );
|
||||
generator->updateResultDefinition();
|
||||
m_dataAnalyticsCollection->addWellTargetMapping( generator );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1461,5 +1457,5 @@ void RimEclipseCase::addWellTargetMapping( RimWellTargetMapping* generator )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultDistanceCollection* RimEclipseCase::faultDistanceCollection() const
|
||||
{
|
||||
return m_faultDistanceCollection;
|
||||
return m_dataAnalyticsCollection ? m_dataAnalyticsCollection->faultDistanceCollection() : nullptr;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ class QString;
|
||||
|
||||
class RimWellTargetMapping;
|
||||
class RimFaultDistanceCollection;
|
||||
class RimDataAnalyticsCollection;
|
||||
class RigCaseCellResultsData;
|
||||
class RigEclipseCaseData;
|
||||
class RigFormationNames;
|
||||
@@ -204,13 +205,12 @@ private:
|
||||
caf::PdmChildField<RimEclipseViewCollection*> m_viewCollection;
|
||||
caf::PdmChildField<RimDataFilterCollection*> m_dataFilterCollection;
|
||||
|
||||
caf::PdmChildArrayField<RimWellTargetMapping*> m_wellTargetMappings;
|
||||
|
||||
caf::PdmChildField<RimFaultDistanceCollection*> m_faultDistanceCollection;
|
||||
caf::PdmChildField<RimDataAnalyticsCollection*> m_dataAnalyticsCollection;
|
||||
|
||||
caf::PdmField<std::vector<caf::FilePath>> m_filesContainingFaults;
|
||||
|
||||
// Obsolete fields:
|
||||
caf::PdmChildArrayField<RimEclipseView*> m_reservoirViews_OBSOLETE;
|
||||
caf::PdmChildField<RimEclipseContourMapViewCollection*> m_contourMapCollection_OBSOLETE;
|
||||
caf::PdmChildArrayField<RimWellTargetMapping*> m_wellTargetMappings_OBSOLETE;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user