Skip to content

Commit

Permalink
Add function to add value filter group
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Jan 16, 2025
1 parent 84523a4 commit a0979f7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace caf
template <>
void caf::AppEnum<RimIntersectionFilterEnum>::setUp()
{
addItem( RimIntersectionFilterEnum::INTERSECT_FILTER_NONE, "INTERSECT_SHOW_ALL", "None" );
addItem( RimIntersectionFilterEnum::INTERSECT_FILTER_NONE, "INTERSECT_SHOW_ALL", "Disabled" );
addItem( RimIntersectionFilterEnum::INTERSECT_FILTER_ABOVE, "INTERSECT_SHOW_ABOVE", "Above" );
addItem( RimIntersectionFilterEnum::INTERSECT_FILTER_BELOW, "INTERSECT_SHOW_BELOW", "Below" );
addItem( RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN, "INTERSECT_SHOW_BELOW", "Between" );
Expand Down
42 changes: 28 additions & 14 deletions ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,19 +587,7 @@ void RimContourMapProjection::defineUiOrdering( QString uiConfigName, caf::PdmUi
mainGroup->add( &m_smoothContourLines );
m_smoothContourLines.uiCapability()->setUiReadOnly( !m_showContourLines() );

auto valueFilterGroup = uiOrdering.addNewGroup( "Value Filter" );
valueFilterGroup->add( &m_valueFilterType );
valueFilterGroup->add( &m_lowerThreshold );
valueFilterGroup->add( &m_upperThreshold );

bool isMinimumUsed = m_valueFilterType() == RimIntersectionFilterEnum::INTERSECT_FILTER_ABOVE ||
m_valueFilterType() == RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN;

m_lowerThreshold.uiCapability()->setUiReadOnly( !isMinimumUsed );

bool isMaximumUsed = m_valueFilterType() == RimIntersectionFilterEnum::INTERSECT_FILTER_BELOW ||
m_valueFilterType() == RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN;
m_upperThreshold.uiCapability()->setUiReadOnly( !isMaximumUsed );
appendValueFilterGroup( uiOrdering );

uiOrdering.skipRemainingFields( true );
}
Expand All @@ -615,8 +603,34 @@ void RimContourMapProjection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTr
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimContourMapProjection::initAfterRead()
void RimContourMapProjection::appendValueFilterGroup( caf::PdmUiOrdering& uiOrdering )
{
auto valueFilterGroup = uiOrdering.addNewGroup( "Value Filter" );
valueFilterGroup->add( &m_valueFilterType );

switch ( m_valueFilterType() )
{
case RimIntersectionFilterEnum::INTERSECT_FILTER_BELOW:
m_upperThreshold.uiCapability()->setUiName( "Threshold" );
valueFilterGroup->add( &m_upperThreshold );
break;

case RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN:
m_lowerThreshold.uiCapability()->setUiName( "Lower Threshold" );
valueFilterGroup->add( &m_lowerThreshold );
m_upperThreshold.uiCapability()->setUiName( "Upper Threshold" );
valueFilterGroup->add( &m_upperThreshold );
break;

case RimIntersectionFilterEnum::INTERSECT_FILTER_ABOVE:
m_lowerThreshold.uiCapability()->setUiName( "Threshold" );
valueFilterGroup->add( &m_lowerThreshold );
break;

case RimIntersectionFilterEnum::INTERSECT_FILTER_NONE:
default:
break;
}
}

//--------------------------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ class RimContourMapProjection : public RimCheckableNamedObject
virtual void updateAfterResultGeneration( int timeStep ) = 0;

protected:
// Framework overrides
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
void initAfterRead() override;

void appendValueFilterGroup( caf::PdmUiOrdering& uiOrdering );

private:
bool resultsNeedsUpdating( int timeStep ) const;
Expand Down

0 comments on commit a0979f7

Please sign in to comment.