Intersection depthfilter (#8408)

* Implement a simple depth filter to cut all geometry below a certain level for intersections
* Add option to override all curve intersection cut depths from collection.
* Add support for showing intersection above or below threshold. Update label texts.
This commit is contained in:
jonjenssen
2022-01-05 15:52:04 +01:00
committed by GitHub
parent eeb51bd8f1
commit 55ba4bc802
11 changed files with 462 additions and 20 deletions

View File

@@ -19,11 +19,14 @@
#include "RimIntersectionCollection.h"
#include "RigMainGrid.h"
#include "Rim2dIntersectionView.h"
#include "Rim2dIntersectionViewCollection.h"
#include "Rim3dView.h"
#include "RimBoxIntersection.h"
#include "RimCase.h"
#include "RimEclipseView.h"
#include "RimExtrudedCurveIntersection.h"
#include "RimGridView.h"
#include "RimIntersectionResultDefinition.h"
@@ -35,6 +38,8 @@
#include "RivBoxIntersectionPartMgr.h"
#include "RivExtrudedCurveIntersectionPartMgr.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiDoubleSliderEditor.h"
#include "cafPdmUiTreeOrdering.h"
#include "cvfModelBasicList.h"
@@ -55,6 +60,14 @@ RimIntersectionCollection::RimIntersectionCollection()
CAF_PDM_InitField( &isActive, "Active", true, "Active" );
isActive.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_collectionDepthThreshold, "CollectionDepthThreshold", "Threshold" );
m_collectionDepthThreshold.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_depthThresholdOverridden, "ThresholdOverridden", false, "Override Intersection Display Settings" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_depthThresholdOverridden );
CAF_PDM_InitFieldNoDefault( &m_collectionDepthDisplayType, "CollectionDepthDisplayType", "Intersection Display Type" );
}
//--------------------------------------------------------------------------------------------------
@@ -267,6 +280,8 @@ void RimIntersectionCollection::appendIntersectionAndUpdate( RimExtrudedCurveInt
{
m_intersections.push_back( intersection );
intersection->setDepthOverride( m_depthThresholdOverridden, m_collectionDepthThreshold, m_collectionDepthDisplayType() );
syncronize2dIntersectionViews();
updateConnectedEditors();
@@ -285,6 +300,7 @@ void RimIntersectionCollection::appendIntersectionAndUpdate( RimExtrudedCurveInt
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::appendIntersectionNoUpdate( RimExtrudedCurveIntersection* intersection )
{
intersection->setDepthOverride( m_depthThresholdOverridden, m_collectionDepthThreshold, m_collectionDepthDisplayType() );
m_intersections.push_back( intersection );
}
@@ -349,6 +365,21 @@ void RimIntersectionCollection::fieldChangedByUi( const caf::PdmFieldHandle* cha
{
updateUiIconFromToggleField();
Rim3dView* rimView = nullptr;
firstAncestorOrThisOfType( rimView );
if ( rimView )
{
rimView->scheduleCreateDisplayModelAndRedraw();
}
}
if ( ( changedField == &m_collectionDepthThreshold ) || ( changedField == &m_depthThresholdOverridden ) ||
( changedField == &m_collectionDepthDisplayType ) )
{
for ( RimExtrudedCurveIntersection* cs : m_intersections )
{
cs->setDepthOverride( m_depthThresholdOverridden, m_collectionDepthThreshold, m_collectionDepthDisplayType() );
}
Rim3dView* rimView = nullptr;
firstAncestorOrThisOfType( rimView );
if ( rimView )
@@ -403,3 +434,57 @@ void RimIntersectionCollection::updateIntersectionBoxGeometry()
intersectionBox->updateBoxManipulatorGeometry();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
if ( eclipseView() )
{
caf::PdmUiGroup* optionsGroup = uiOrdering.addNewGroup( "Curve Intersections" );
optionsGroup->add( &m_depthThresholdOverridden );
optionsGroup->add( &m_collectionDepthDisplayType );
optionsGroup->add( &m_collectionDepthThreshold );
m_collectionDepthDisplayType.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() );
m_collectionDepthThreshold.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() );
}
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
auto* doubleSliderAttrib = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute );
if ( doubleSliderAttrib )
{
if ( field == &m_collectionDepthThreshold )
{
RimEclipseView* eclView = eclipseView();
if ( eclView )
{
const cvf::BoundingBox bb = eclView->mainGrid()->boundingBox();
doubleSliderAttrib->m_minimum = -1.0 * bb.max().z();
doubleSliderAttrib->m_maximum = -1.0 * bb.min().z();
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseView* RimIntersectionCollection::eclipseView() const
{
RimEclipseView* eclipseView = nullptr;
firstAncestorOrThisOfType( eclipseView );
return eclipseView;
}