mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#11994 Allow property filter to be linked to cell result
This commit is contained in:
parent
997e14c90e
commit
0ec9a36406
@ -22,6 +22,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportRoffCaseFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicAddGridCalculationFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCaseEnsemblesFromFilesFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicAddLinkedEclipsePropertyFilterFeature.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@ -48,6 +49,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicImportRoffCaseFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicAddGridCalculationFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCaseEnsemblesFromFilesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicAddLinkedEclipsePropertyFilterFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
@ -0,0 +1,70 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024- 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 "RicAddLinkedEclipsePropertyFilterFeature.h"
|
||||
|
||||
#include "RicEclipsePropertyFilterFeatureImpl.h"
|
||||
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicAddLinkedEclipsePropertyFilterFeature, "RicAddLinkedEclipsePropertyFilterFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicAddLinkedEclipsePropertyFilterFeature::isCommandEnabled() const
|
||||
{
|
||||
auto filterCollections = RicEclipsePropertyFilterFeatureImpl::selectedPropertyFilterCollections();
|
||||
if ( filterCollections.size() == 1 )
|
||||
{
|
||||
return RicEclipsePropertyFilterFeatureImpl::isPropertyFilterCommandAvailable( filterCollections[0] );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddLinkedEclipsePropertyFilterFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto filterCollections = RicEclipsePropertyFilterFeatureImpl::selectedPropertyFilterCollections();
|
||||
|
||||
if ( filterCollections.size() == 1 )
|
||||
{
|
||||
auto coll = filterCollections[0];
|
||||
auto filter = coll->addFilterLinkedToCellResult();
|
||||
coll->updateAllRequiredEditors();
|
||||
|
||||
Riu3DMainWindowTools::setExpanded( filter );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAddLinkedEclipsePropertyFilterFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setIcon( QIcon( ":/CellFilter_Values.png" ) );
|
||||
actionToSetup->setText( "Add Property Filter Linked to Cell Result" );
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024- 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 "cafCmdFeature.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicAddLinkedEclipsePropertyFilterFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() const override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -40,6 +40,7 @@
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
#include "cafPdmUiSliderEditor.h"
|
||||
#include "cafPdmUiTreeAttributes.h"
|
||||
@ -65,6 +66,13 @@ RimEclipsePropertyFilter::RimEclipsePropertyFilter()
|
||||
// Fields in this object are displayed using defineUiOrdering()
|
||||
m_resultDefinition.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_linkedWithCellResult,
|
||||
"LinkedWithCellResult",
|
||||
"Linked With Cell Result",
|
||||
"",
|
||||
"The selected cell result is automatically used to update the property filter." );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_linkedWithCellResult );
|
||||
|
||||
CAF_PDM_InitField( &m_rangeLabelText, "Dummy_keyword", QString( "Range Type" ), "Range Type" );
|
||||
m_rangeLabelText.xmlCapability()->disableIO();
|
||||
m_rangeLabelText.uiCapability()->setUiReadOnly( true );
|
||||
@ -119,6 +127,22 @@ RimEclipseResultDefinition* RimEclipsePropertyFilter::resultDefinition() const
|
||||
return m_resultDefinition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipsePropertyFilter::isLinkedWithCellResult() const
|
||||
{
|
||||
return m_linkedWithCellResult();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilter::setLinkedWithCellResult( bool linkedWithCellResult )
|
||||
{
|
||||
m_linkedWithCellResult = linkedWithCellResult;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -161,7 +185,7 @@ void RimEclipsePropertyFilter::fieldChangedByUi( const caf::PdmFieldHandle* chan
|
||||
|
||||
if ( &m_lowerBound == changedField || &m_upperBound == changedField || &m_isActive == changedField || &m_filterMode == changedField ||
|
||||
&m_selectedCategoryValues == changedField || &m_useCategorySelection == changedField || &m_integerUpperBound == changedField ||
|
||||
&m_integerLowerBound == changedField )
|
||||
&m_integerLowerBound == changedField || &m_linkedWithCellResult == changedField )
|
||||
{
|
||||
m_isDuplicatedFromLinkedView = false;
|
||||
|
||||
@ -207,6 +231,13 @@ void RimEclipsePropertyFilter::defineUiOrdering( QString uiConfigName, caf::PdmU
|
||||
// Fields declared in RimCellFilter
|
||||
uiOrdering.add( &m_name );
|
||||
|
||||
uiOrdering.add( &m_linkedWithCellResult );
|
||||
if ( m_linkedWithCellResult )
|
||||
{
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
return;
|
||||
}
|
||||
|
||||
// Fields declared in Rimm_resultDefinition
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup( "Result" );
|
||||
m_resultDefinition->uiOrdering( uiConfigName, *group1 );
|
||||
|
@ -41,6 +41,8 @@ public:
|
||||
~RimEclipsePropertyFilter() override;
|
||||
|
||||
RimEclipseResultDefinition* resultDefinition() const;
|
||||
bool isLinkedWithCellResult() const;
|
||||
void setLinkedWithCellResult( bool linkedWithCellResult );
|
||||
|
||||
void rangeValues( double* lower, double* upper ) const;
|
||||
bool isCategorySelectionActive() const;
|
||||
@ -84,10 +86,12 @@ private:
|
||||
|
||||
private:
|
||||
caf::PdmChildField<RimEclipseResultDefinition*> m_resultDefinition;
|
||||
caf::PdmField<QString> m_rangeLabelText;
|
||||
|
||||
caf::PdmField<double> m_lowerBound;
|
||||
caf::PdmField<double> m_upperBound;
|
||||
caf::PdmField<bool> m_linkedWithCellResult;
|
||||
|
||||
caf::PdmField<QString> m_rangeLabelText;
|
||||
caf::PdmField<double> m_lowerBound;
|
||||
caf::PdmField<double> m_upperBound;
|
||||
|
||||
caf::PdmProxyValueField<int> m_integerLowerBound;
|
||||
caf::PdmProxyValueField<int> m_integerUpperBound;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "RimViewController.h"
|
||||
#include "RimViewLinker.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiEditorHandle.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimEclipsePropertyFilterCollection, "CellPropertyFilters" );
|
||||
@ -191,3 +192,55 @@ void RimEclipsePropertyFilterCollection::updateFromCurrentTimeStep()
|
||||
cellFilter->updateFromCurrentTimeStep();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilterCollection::updateDefaultResult( const RimEclipseCellColors* result )
|
||||
{
|
||||
if ( !result ) return;
|
||||
if ( m_propertyFilters.empty() ) return;
|
||||
|
||||
auto view = reservoirView();
|
||||
for ( auto filter : m_propertyFilters )
|
||||
{
|
||||
if ( !filter->isLinkedWithCellResult() ) continue;
|
||||
|
||||
if ( view && view->eclipseCase() )
|
||||
{
|
||||
filter->resultDefinition()->setEclipseCase( view->eclipseCase() );
|
||||
}
|
||||
|
||||
filter->resultDefinition()->simpleCopy( result );
|
||||
filter->resultDefinition()->loadResult();
|
||||
filter->setToDefaultValues();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipsePropertyFilter* RimEclipsePropertyFilterCollection::addFilterLinkedToCellResult()
|
||||
{
|
||||
RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter();
|
||||
propertyFilter->setLinkedWithCellResult( true );
|
||||
m_propertyFilters.push_back( propertyFilter );
|
||||
|
||||
auto view = reservoirView();
|
||||
if ( view && view->eclipseCase() )
|
||||
{
|
||||
propertyFilter->resultDefinition()->setEclipseCase( view->eclipseCase() );
|
||||
updateDefaultResult( view->cellResult() );
|
||||
}
|
||||
|
||||
return propertyFilter;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilterCollection::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const
|
||||
{
|
||||
menuBuilder << "RicEclipsePropertyFilterNewFeature";
|
||||
menuBuilder << "RicAddLinkedEclipsePropertyFilterFeature";
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
class RimEclipsePropertyFilter;
|
||||
class RimEclipseView;
|
||||
class RimEclipseCellColors;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -53,8 +54,12 @@ public:
|
||||
void updateIconState() override;
|
||||
void updateFromCurrentTimeStep();
|
||||
|
||||
void updateDefaultResult( const RimEclipseCellColors* result );
|
||||
RimEclipsePropertyFilter* addFilterLinkedToCellResult();
|
||||
|
||||
protected:
|
||||
void initAfterRead() override;
|
||||
void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimEclipsePropertyFilter*> m_propertyFilters;
|
||||
|
@ -51,7 +51,6 @@
|
||||
#include "RimEclipseFaultColors.h"
|
||||
#include "RimEclipseInputProperty.h"
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimEclipseResultAddress.h"
|
||||
#include "RimEclipseStatisticsCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
@ -317,10 +316,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
menuBuilder << "RicSaveEclipseInputPropertyFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimEclipsePropertyFilterCollection*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicEclipsePropertyFilterNewFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimEclipsePropertyFilter*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicEclipsePropertyFilterInsertFeature";
|
||||
|
@ -542,6 +542,8 @@ void RimEclipseView::childFieldChangedByUi( const caf::PdmFieldHandle* changedCh
|
||||
if ( changedChildField == &m_cellResult )
|
||||
{
|
||||
updateMdiWindowTitle();
|
||||
|
||||
m_propertyFilterCollection->updateDefaultResult( m_cellResult() );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user