Skip to content

Commit

Permalink
#11994 Allow property filter to be linked to cell result
Browse files Browse the repository at this point in the history
Update the result in property editor when the cell result changes
  • Loading branch information
magnesj committed Dec 16, 2024
1 parent 707c5f4 commit d5c841a
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ 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" );

CAF_PDM_InitField( &m_rangeLabelText, "Dummy_keyword", QString( "Range Type" ), "Range Type" );
m_rangeLabelText.xmlCapability()->disableIO();
m_rangeLabelText.uiCapability()->setUiReadOnly( true );
Expand Down Expand Up @@ -119,6 +121,22 @@ RimEclipseResultDefinition* RimEclipsePropertyFilter::resultDefinition() const
return m_resultDefinition;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipsePropertyFilter::isLinkedWithCellResult() const
{
return m_linkedWithCellResult();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilter::setLinkedWithCellResult( bool linkedWithCellResult )
{
m_linkedWithCellResult = linkedWithCellResult;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -161,7 +179,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 )
{
m_isDuplicatedFromLinkedView = false;

Expand Down Expand Up @@ -209,7 +227,12 @@ void RimEclipsePropertyFilter::defineUiOrdering( QString uiConfigName, caf::PdmU

// Fields declared in Rimm_resultDefinition
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup( "Result" );
m_resultDefinition->uiOrdering( uiConfigName, *group1 );
group1->add( &m_linkedWithCellResult );

if ( !m_linkedWithCellResult )
{
m_resultDefinition->uiOrdering( uiConfigName, *group1 );
}

caf::PdmUiGroup& group2 = *( uiOrdering.addNewGroup( "Filter Settings" ) );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class RimEclipsePropertyFilter : public RimPropertyFilter, public RimFieldQuickA
~RimEclipsePropertyFilter() override;

RimEclipseResultDefinition* resultDefinition() const;
bool isLinkedWithCellResult() const;
void setLinkedWithCellResult( bool linkedWithCellResult );

void rangeValues( double* lower, double* upper ) const;
bool isCategorySelectionActive() const;
Expand Down Expand Up @@ -84,10 +86,12 @@ class RimEclipsePropertyFilter : public RimPropertyFilter, public RimFieldQuickA

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,28 @@ 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()->loadResult();

filter->resultDefinition()->simpleCopy( result );
filter->setToDefaultValues();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

class RimEclipsePropertyFilter;
class RimEclipseView;
class RimEclipseCellColors;

//==================================================================================================
///
Expand Down Expand Up @@ -53,6 +54,8 @@ class RimEclipsePropertyFilterCollection : public RimPropertyFilterCollection
void updateIconState() override;
void updateFromCurrentTimeStep();

void updateDefaultResult( const RimEclipseCellColors* result );

protected:
void initAfterRead() override;

Expand Down
2 changes: 2 additions & 0 deletions ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ void RimEclipseView::childFieldChangedByUi( const caf::PdmFieldHandle* changedCh
if ( changedChildField == &m_cellResult )
{
updateMdiWindowTitle();

m_propertyFilterCollection->updateDefaultResult( m_cellResult() );
}
}

Expand Down

0 comments on commit d5c841a

Please sign in to comment.