mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Support copy of property filters to linked views
* Copy and overwrite property filters when linked When linking property filters between different cases, the property filter settings are copied and the property filter is evaluated per case. The previous implementation worked only for a single case. * Move field to private
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
#include "cafPdmUiTreeAttributes.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
@@ -76,6 +77,9 @@ RimEclipsePropertyFilter::RimEclipsePropertyFilter()
|
||||
CAF_PDM_InitField( &m_useCategorySelection, "CategorySelection", false, "Category Selection" );
|
||||
m_upperBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_isDuplicatedFromLinkedView, "IsDuplicatedFromLinkedView", false, "Duplicated" );
|
||||
m_isDuplicatedFromLinkedView.uiCapability()->setUiHidden( true );
|
||||
|
||||
// HEADLESS HACK
|
||||
if ( RiaGuiApplication::isRunning() )
|
||||
{
|
||||
@@ -124,6 +128,14 @@ bool RimEclipsePropertyFilter::isCategorySelectionActive() const
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilter::setIsDuplicatedFromLinkedView( bool isDuplicated )
|
||||
{
|
||||
m_isDuplicatedFromLinkedView = isDuplicated;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -131,23 +143,20 @@ void RimEclipsePropertyFilter::fieldChangedByUi( const caf::PdmFieldHandle* chan
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
// clang-format off
|
||||
if ( &m_lowerBound == changedField
|
||||
|| &m_upperBound == changedField
|
||||
|| &m_isActive == changedField
|
||||
|| &m_filterMode == changedField
|
||||
|| &m_selectedCategoryValues == changedField
|
||||
|| &m_useCategorySelection == changedField)
|
||||
if ( &m_lowerBound == changedField || &m_upperBound == changedField || &m_isActive == changedField ||
|
||||
&m_filterMode == changedField || &m_selectedCategoryValues == changedField ||
|
||||
&m_useCategorySelection == changedField )
|
||||
{
|
||||
m_isDuplicatedFromLinkedView = false;
|
||||
|
||||
this->m_resultDefinition->loadResult();
|
||||
this->computeResultValueRange();
|
||||
updateFilterName();
|
||||
this->updateIconState();
|
||||
this->uiCapability()->updateConnectedEditors();
|
||||
|
||||
parentContainer()->updateDisplayModelNotifyManagedViews(this);
|
||||
parentContainer()->updateDisplayModelNotifyManagedViews( this );
|
||||
}
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -341,6 +350,31 @@ void RimEclipsePropertyFilter::defineEditorAttribute( const caf::PdmFieldHandle*
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilter::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( !m_isDuplicatedFromLinkedView ) return;
|
||||
|
||||
Rim3dView* rimView = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( rimView );
|
||||
|
||||
RimViewController* vc = rimView->viewController();
|
||||
if ( vc && vc->isPropertyFilterDuplicationActive() )
|
||||
{
|
||||
auto* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( 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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
void rangeValues( double* lower, double* upper ) const;
|
||||
bool isCategorySelectionActive() const;
|
||||
|
||||
void setIsDuplicatedFromLinkedView( bool isControlled );
|
||||
|
||||
void setToDefaultValues();
|
||||
void updateFilterName();
|
||||
void computeResultValueRange();
|
||||
@@ -62,6 +64,9 @@ private:
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
private:
|
||||
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
private:
|
||||
friend class RimEclipsePropertyFilterCollection;
|
||||
friend class RicEclipsePropertyFilterFeatureImpl;
|
||||
@@ -79,6 +84,7 @@ private:
|
||||
caf::PdmField<QString> m_rangeLabelText;
|
||||
caf::PdmField<double> m_lowerBound;
|
||||
caf::PdmField<double> m_upperBound;
|
||||
caf::PdmField<bool> m_isDuplicatedFromLinkedView;
|
||||
|
||||
caf::PdmField<bool> m_useCategorySelection;
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ RimEclipsePropertyFilterCollection::RimEclipsePropertyFilterCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Property Filters", ":/CellFilter_Values.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &propertyFilters, "PropertyFilters", "Property Filters" );
|
||||
propertyFilters.uiCapability()->setUiTreeHidden( true );
|
||||
CAF_PDM_InitFieldNoDefault( &m_propertyFilters, "PropertyFilters", "Property Filters" );
|
||||
m_propertyFilters.uiCapability()->setUiTreeHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -47,7 +47,7 @@ RimEclipsePropertyFilterCollection::RimEclipsePropertyFilterCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipsePropertyFilterCollection::~RimEclipsePropertyFilterCollection()
|
||||
{
|
||||
propertyFilters.deleteChildren();
|
||||
m_propertyFilters.deleteChildren();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -61,12 +61,39 @@ RimEclipseView* RimEclipsePropertyFilterCollection::reservoirView()
|
||||
return eclipseView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilterCollection::setIsDuplicatedFromLinkedView()
|
||||
{
|
||||
for ( RimEclipsePropertyFilter* propertyFilter : m_propertyFilters )
|
||||
{
|
||||
propertyFilter->setIsDuplicatedFromLinkedView( true );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipsePropertyFilter*> RimEclipsePropertyFilterCollection::propertyFilters() const
|
||||
{
|
||||
return m_propertyFilters.children();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmChildArrayField<RimEclipsePropertyFilter*>& RimEclipsePropertyFilterCollection::propertyFiltersField()
|
||||
{
|
||||
return m_propertyFilters;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilterCollection::loadAndInitializePropertyFilters()
|
||||
{
|
||||
for ( RimEclipsePropertyFilter* propertyFilter : propertyFilters )
|
||||
for ( RimEclipsePropertyFilter* propertyFilter : m_propertyFilters )
|
||||
{
|
||||
propertyFilter->resultDefinition()->setEclipseCase( reservoirView()->eclipseCase() );
|
||||
propertyFilter->initAfterRead();
|
||||
@@ -93,7 +120,7 @@ bool RimEclipsePropertyFilterCollection::hasActiveFilters() const
|
||||
{
|
||||
if ( !isActive ) return false;
|
||||
|
||||
for ( RimEclipsePropertyFilter* propertyFilter : propertyFilters )
|
||||
for ( RimEclipsePropertyFilter* propertyFilter : m_propertyFilters )
|
||||
{
|
||||
if ( propertyFilter->isActive() && propertyFilter->resultDefinition()->hasResult() ) return true;
|
||||
}
|
||||
@@ -108,7 +135,7 @@ bool RimEclipsePropertyFilterCollection::hasActiveDynamicFilters() const
|
||||
{
|
||||
if ( !isActive ) return false;
|
||||
|
||||
for ( RimEclipsePropertyFilter* propertyFilter : propertyFilters )
|
||||
for ( RimEclipsePropertyFilter* propertyFilter : m_propertyFilters )
|
||||
{
|
||||
if ( propertyFilter->isActive() && propertyFilter->resultDefinition()->hasDynamicResult() ) return true;
|
||||
}
|
||||
@@ -123,7 +150,7 @@ bool RimEclipsePropertyFilterCollection::isUsingFormationNames() const
|
||||
{
|
||||
if ( !isActive ) return false;
|
||||
|
||||
for ( RimEclipsePropertyFilter* propertyFilter : propertyFilters )
|
||||
for ( RimEclipsePropertyFilter* propertyFilter : m_propertyFilters )
|
||||
{
|
||||
if ( propertyFilter->isActive() &&
|
||||
propertyFilter->resultDefinition()->resultType() == RiaDefines::ResultCatType::FORMATION_NAMES &&
|
||||
@@ -159,7 +186,7 @@ void RimEclipsePropertyFilterCollection::updateIconState()
|
||||
|
||||
updateUiIconFromState( activeIcon );
|
||||
|
||||
for ( RimEclipsePropertyFilter* cellFilter : propertyFilters )
|
||||
for ( RimEclipsePropertyFilter* cellFilter : m_propertyFilters )
|
||||
{
|
||||
cellFilter->updateActiveState();
|
||||
cellFilter->updateIconState();
|
||||
@@ -171,7 +198,7 @@ void RimEclipsePropertyFilterCollection::updateIconState()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilterCollection::updateFromCurrentTimeStep()
|
||||
{
|
||||
for ( RimEclipsePropertyFilter* cellFilter : propertyFilters() )
|
||||
for ( RimEclipsePropertyFilter* cellFilter : m_propertyFilters() )
|
||||
{
|
||||
cellFilter->updateFromCurrentTimeStep();
|
||||
}
|
||||
|
||||
@@ -40,11 +40,11 @@ public:
|
||||
~RimEclipsePropertyFilterCollection() override;
|
||||
|
||||
RimEclipseView* reservoirView();
|
||||
void setIsDuplicatedFromLinkedView();
|
||||
|
||||
// Fields:
|
||||
caf::PdmChildArrayField<RimEclipsePropertyFilter*> propertyFilters;
|
||||
std::vector<RimEclipsePropertyFilter*> propertyFilters() const;
|
||||
caf::PdmChildArrayField<RimEclipsePropertyFilter*>& propertyFiltersField();
|
||||
|
||||
// Methods
|
||||
bool hasActiveFilters() const override;
|
||||
bool hasActiveDynamicFilters() const override;
|
||||
bool isUsingFormationNames() const;
|
||||
@@ -55,6 +55,8 @@ public:
|
||||
void updateFromCurrentTimeStep();
|
||||
|
||||
protected:
|
||||
// Overridden methods
|
||||
void initAfterRead() override;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimEclipsePropertyFilter*> m_propertyFilters;
|
||||
};
|
||||
|
||||
@@ -66,16 +66,21 @@ void RimPropertyFilterCollection::updateDisplayModelNotifyManagedViews( RimPrope
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPropertyFilterCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
Rim3dView* view = nullptr;
|
||||
this->firstAncestorOrThisOfType( view );
|
||||
CVF_ASSERT( view );
|
||||
if ( !view ) return;
|
||||
updateDisplayModelNotifyManagedViews( nullptr );
|
||||
}
|
||||
|
||||
view->scheduleGeometryRegen( PROPERTY_FILTERED );
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPropertyFilterCollection::onChildAdded( caf::PdmFieldHandle* containerForNewObject )
|
||||
{
|
||||
updateDisplayModelNotifyManagedViews( nullptr );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
virtual void updateIconState() = 0;
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
void onChildAdded( caf::PdmFieldHandle* containerForNewObject ) override;
|
||||
|
||||
protected:
|
||||
// Overridden methods
|
||||
|
||||
Reference in New Issue
Block a user