mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
2d intersection view filter support (#11711)
Enable filters in 2d intersection view. Controlled by "Use Cell Filters for Intersections" setting in Intersection Collection properties
This commit is contained in:
parent
f95b085419
commit
e006fe52c9
@ -842,52 +842,58 @@ void RivExtrudedCurveIntersectionPartMgr::appendMeshLinePartsToModel( cvf::Model
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivExtrudedCurveIntersectionPartMgr::appendPolylinePartsToModel( Rim3dView& view, cvf::ModelBasicList* model, cvf::Transform* scaleTransform )
|
||||
void RivExtrudedCurveIntersectionPartMgr::appendPolylinePartsToModel( Rim3dView& view,
|
||||
cvf::ModelBasicList* model,
|
||||
cvf::Transform* scaleTransform,
|
||||
bool annotationOnly )
|
||||
{
|
||||
auto* curr2dView = dynamic_cast<Rim2dIntersectionView*>( &view );
|
||||
|
||||
if ( m_rimIntersection->inputPolyLineFromViewerEnabled() || ( curr2dView && curr2dView->showDefiningPoints() ) )
|
||||
if ( !annotationOnly )
|
||||
{
|
||||
if ( m_highlightLineAlongPolyline.notNull() )
|
||||
if ( m_rimIntersection->inputPolyLineFromViewerEnabled() || ( curr2dView && curr2dView->showDefiningPoints() ) )
|
||||
{
|
||||
m_highlightLineAlongPolyline->setTransform( scaleTransform );
|
||||
model->addPart( m_highlightLineAlongPolyline.p() );
|
||||
if ( m_highlightLineAlongPolyline.notNull() )
|
||||
{
|
||||
m_highlightLineAlongPolyline->setTransform( scaleTransform );
|
||||
model->addPart( m_highlightLineAlongPolyline.p() );
|
||||
}
|
||||
|
||||
if ( m_highlightPointsForPolyline.notNull() )
|
||||
{
|
||||
m_highlightPointsForPolyline->setTransform( scaleTransform );
|
||||
model->addPart( m_highlightPointsForPolyline.p() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_highlightPointsForPolyline.notNull() )
|
||||
if ( m_rimIntersection->inputExtrusionPointsFromViewerEnabled() )
|
||||
{
|
||||
m_highlightPointsForPolyline->setTransform( scaleTransform );
|
||||
model->addPart( m_highlightPointsForPolyline.p() );
|
||||
}
|
||||
}
|
||||
if ( m_highlightLineAlongExtrusionDir.notNull() )
|
||||
{
|
||||
m_highlightLineAlongExtrusionDir->setTransform( scaleTransform );
|
||||
model->addPart( m_highlightLineAlongExtrusionDir.p() );
|
||||
}
|
||||
|
||||
if ( m_rimIntersection->inputExtrusionPointsFromViewerEnabled() )
|
||||
{
|
||||
if ( m_highlightLineAlongExtrusionDir.notNull() )
|
||||
{
|
||||
m_highlightLineAlongExtrusionDir->setTransform( scaleTransform );
|
||||
model->addPart( m_highlightLineAlongExtrusionDir.p() );
|
||||
if ( m_highlightPointsForExtrusionDir.notNull() )
|
||||
{
|
||||
m_highlightPointsForExtrusionDir->setTransform( scaleTransform );
|
||||
model->addPart( m_highlightPointsForExtrusionDir.p() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_highlightPointsForExtrusionDir.notNull() )
|
||||
if ( m_rimIntersection->inputTwoAzimuthPointsFromViewerEnabled() || ( curr2dView && curr2dView->showDefiningPoints() ) )
|
||||
{
|
||||
m_highlightPointsForExtrusionDir->setTransform( scaleTransform );
|
||||
model->addPart( m_highlightPointsForExtrusionDir.p() );
|
||||
}
|
||||
}
|
||||
if ( m_highlightLineAlongPolyline.notNull() )
|
||||
{
|
||||
m_highlightLineAlongPolyline->setTransform( scaleTransform );
|
||||
model->addPart( m_highlightLineAlongPolyline.p() );
|
||||
}
|
||||
|
||||
if ( m_rimIntersection->inputTwoAzimuthPointsFromViewerEnabled() || ( curr2dView && curr2dView->showDefiningPoints() ) )
|
||||
{
|
||||
if ( m_highlightLineAlongPolyline.notNull() )
|
||||
{
|
||||
m_highlightLineAlongPolyline->setTransform( scaleTransform );
|
||||
model->addPart( m_highlightLineAlongPolyline.p() );
|
||||
}
|
||||
|
||||
if ( m_highlightPointsForPolyline.notNull() )
|
||||
{
|
||||
m_highlightPointsForPolyline->setTransform( scaleTransform );
|
||||
model->addPart( m_highlightPointsForPolyline.p() );
|
||||
if ( m_highlightPointsForPolyline.notNull() )
|
||||
{
|
||||
m_highlightPointsForPolyline->setTransform( scaleTransform );
|
||||
model->addPart( m_highlightPointsForPolyline.p() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
|
||||
void appendIntersectionFacesToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform );
|
||||
void appendMeshLinePartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform );
|
||||
void appendPolylinePartsToModel( Rim3dView& view, cvf::ModelBasicList* model, cvf::Transform* scaleTransform );
|
||||
void appendPolylinePartsToModel( Rim3dView& view, cvf::ModelBasicList* model, cvf::Transform* scaleTransform, bool annotationOnly = false );
|
||||
|
||||
cvf::Mat4d unflattenTransformMatrix( const cvf::Vec3d& intersectionPointFlat ) const;
|
||||
|
||||
|
@ -20,13 +20,16 @@
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimExtrudedCurveIntersection.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimIntersectionResultDefinition.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSimWellInView.h"
|
||||
@ -516,16 +519,19 @@ void Rim2dIntersectionView::onCreateDisplayModel()
|
||||
nativeOrOverrideViewer()->addFrame( new cvf::Scene(), isUsingOverrideViewer() );
|
||||
}
|
||||
|
||||
m_flatIntersectionPartMgr = new RivExtrudedCurveIntersectionPartMgr( m_intersection(), true );
|
||||
bool propertiesFiltersActive = false;
|
||||
bool cellFiltersActive = false;
|
||||
|
||||
m_intersectionVizModel->removeAllParts();
|
||||
RimGridView* grView = m_intersection->firstAncestorOrThisOfType<RimGridView>();
|
||||
if ( grView && grView->intersectionCollection()->shouldApplyCellFiltersToIntersections() )
|
||||
{
|
||||
propertiesFiltersActive = grView->propertyFilterCollection()->hasActiveFilters();
|
||||
cellFiltersActive = grView->cellFilterCollection()->hasActiveFilters();
|
||||
}
|
||||
|
||||
m_flatIntersectionPartMgr->generatePartGeometry( nullptr, scaleTransform() );
|
||||
m_flatIntersectionPartMgr->appendIntersectionFacesToModel( m_intersectionVizModel.p(), scaleTransform() );
|
||||
m_flatIntersectionPartMgr->appendMeshLinePartsToModel( m_intersectionVizModel.p(), scaleTransform() );
|
||||
m_flatIntersectionPartMgr->appendPolylinePartsToModel( *this, m_intersectionVizModel.p(), scaleTransform() );
|
||||
m_flatIntersectionPartMgr = new RivExtrudedCurveIntersectionPartMgr( m_intersection, true );
|
||||
|
||||
m_flatIntersectionPartMgr->applySingleColorEffect();
|
||||
appendIntersectionToModel( cellFiltersActive, propertiesFiltersActive );
|
||||
|
||||
m_flatSimWellPipePartMgr = nullptr;
|
||||
m_flatWellHeadPartMgr = nullptr;
|
||||
@ -574,6 +580,17 @@ void Rim2dIntersectionView::onUpdateDisplayModelForCurrentTimeStep()
|
||||
update3dInfo();
|
||||
onUpdateLegends();
|
||||
|
||||
RimGridView* grView = m_intersection->firstAncestorOrThisOfType<RimGridView>();
|
||||
if ( grView )
|
||||
{
|
||||
if ( grView->intersectionCollection()->shouldApplyCellFiltersToIntersections() &&
|
||||
grView->propertyFilterCollection()->hasActiveFilters() )
|
||||
{
|
||||
m_flatIntersectionPartMgr = new RivExtrudedCurveIntersectionPartMgr( m_intersection, true );
|
||||
appendIntersectionForCurrentTimeStep();
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_flatSimWellPipePartMgr.notNull() )
|
||||
{
|
||||
cvf::Scene* frameScene = nativeOrOverrideViewer()->frame( m_currentTimeStep, isUsingOverrideViewer() );
|
||||
@ -831,3 +848,118 @@ void Rim2dIntersectionView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTree
|
||||
{
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim2dIntersectionView::appendIntersectionToModel( bool cellFiltersActive, bool propertyFiltersActive )
|
||||
{
|
||||
m_intersectionVizModel->removeAllParts();
|
||||
|
||||
RimEclipseView* eclView = m_intersection->firstAncestorOrThisOfType<RimEclipseView>();
|
||||
RimGeoMechView* geoView = m_intersection->firstAncestorOrThisOfType<RimGeoMechView>();
|
||||
|
||||
if ( cellFiltersActive || propertyFiltersActive )
|
||||
{
|
||||
if ( eclView )
|
||||
{
|
||||
if ( !propertyFiltersActive )
|
||||
{
|
||||
cvf::UByteArray visibleCells;
|
||||
eclView->calculateCellVisibility( &visibleCells, { RANGE_FILTERED_WELL_CELLS, RANGE_FILTERED }, m_currentTimeStep );
|
||||
appendDynamicPartsToModel( m_intersectionVizModel.p(), scaleTransform(), &visibleCells );
|
||||
}
|
||||
}
|
||||
else if ( geoView )
|
||||
{
|
||||
if ( !propertyFiltersActive )
|
||||
{
|
||||
cvf::UByteArray visibleCells;
|
||||
geoView->calculateCurrentTotalCellVisibility( &visibleCells, m_currentTimeStep );
|
||||
appendDynamicPartsToModel( m_intersectionVizModel.p(), scaleTransform(), &visibleCells );
|
||||
}
|
||||
}
|
||||
|
||||
// NB! Geometry objects are recreated in appendDynamicPartsToModel(), always call
|
||||
// appendPartsToModel() after appendDynamicPartsToModel()
|
||||
appendPartsToModel( m_intersectionVizModel.p(), scaleTransform() );
|
||||
}
|
||||
else
|
||||
{
|
||||
appendDynamicPartsToModel( m_intersectionVizModel.p(), scaleTransform(), nullptr );
|
||||
|
||||
// NB! Geometry objects are recreated in appendDynamicPartsToModel(), always call
|
||||
// appendPartsToModel() after appendDynamicPartsToModel()
|
||||
appendPartsToModel( m_intersectionVizModel.p(), scaleTransform() );
|
||||
}
|
||||
m_intersectionVizModel->updateBoundingBoxesRecursive();
|
||||
nativeOrOverrideViewer()->addStaticModelOnce( m_intersectionVizModel.p(), isUsingOverrideViewer() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim2dIntersectionView::appendIntersectionForCurrentTimeStep()
|
||||
{
|
||||
if ( nativeOrOverrideViewer() )
|
||||
{
|
||||
cvf::Scene* frameScene = nativeOrOverrideViewer()->frame( m_currentTimeStep, isUsingOverrideViewer() );
|
||||
if ( frameScene )
|
||||
{
|
||||
cvf::String name = "IntersectionDynamicModel";
|
||||
Rim3dView::removeModelByName( frameScene, name );
|
||||
|
||||
cvf::ref<cvf::ModelBasicList> frameParts = new cvf::ModelBasicList;
|
||||
frameParts->setName( name );
|
||||
|
||||
RimEclipseView* eclView = m_intersection->firstAncestorOrThisOfType<RimEclipseView>();
|
||||
RimGeoMechView* geoView = m_intersection->firstAncestorOrThisOfType<RimGeoMechView>();
|
||||
if ( eclView )
|
||||
{
|
||||
cvf::UByteArray visibility;
|
||||
eclView->calculateCellVisibility( &visibility, { PROPERTY_FILTERED, PROPERTY_FILTERED_WELL_CELLS }, m_currentTimeStep );
|
||||
appendDynamicPartsToModel( frameParts.p(), scaleTransform(), &visibility );
|
||||
}
|
||||
else if ( geoView )
|
||||
{
|
||||
cvf::UByteArray visibility;
|
||||
geoView->calculateCurrentTotalCellVisibility( &visibility, m_currentTimeStep );
|
||||
appendDynamicPartsToModel( frameParts.p(), scaleTransform(), &visibility );
|
||||
}
|
||||
else
|
||||
{
|
||||
appendDynamicPartsToModel( frameParts.p(), scaleTransform(), nullptr );
|
||||
}
|
||||
frameParts->updateBoundingBoxesRecursive();
|
||||
|
||||
frameScene->addModel( frameParts.p() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim2dIntersectionView::appendPartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform )
|
||||
{
|
||||
m_flatIntersectionPartMgr->appendPolylinePartsToModel( *this, model, scaleTransform, true /*annotationOnly*/ );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim2dIntersectionView::appendDynamicPartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform, cvf::UByteArray* visibleCells )
|
||||
{
|
||||
m_flatIntersectionPartMgr->generatePartGeometry( visibleCells, scaleTransform );
|
||||
m_flatIntersectionPartMgr->appendIntersectionFacesToModel( model, scaleTransform );
|
||||
m_flatIntersectionPartMgr->appendMeshLinePartsToModel( model, scaleTransform );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim2dIntersectionView::onCellVisibilityChanged( const SignalEmitter* emitter )
|
||||
{
|
||||
onCreateDisplayModel();
|
||||
scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "Rim3dView.h"
|
||||
#include "cafPdmProxyValueField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
#include "cvfArray.h"
|
||||
|
||||
class RimExtrudedCurveIntersection;
|
||||
class RimRegularLegendConfig;
|
||||
@ -73,6 +74,8 @@ public:
|
||||
|
||||
std::vector<RimLegendConfig*> legendConfigs() const override;
|
||||
|
||||
void onCellVisibilityChanged( const SignalEmitter* emitter );
|
||||
|
||||
protected:
|
||||
void onUpdateLegends() override;
|
||||
|
||||
@ -96,11 +99,17 @@ protected:
|
||||
|
||||
size_t onTimeStepCountRequested() override;
|
||||
|
||||
void appendIntersectionForCurrentTimeStep();
|
||||
void appendIntersectionToModel( bool cellFiltersActive, bool propertyFiltersActive );
|
||||
|
||||
private:
|
||||
QString createAutoName() const override;
|
||||
QString getName() const;
|
||||
void setName( const QString& name );
|
||||
|
||||
void appendPartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform );
|
||||
void appendDynamicPartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform, cvf::UByteArray* visibleCells );
|
||||
|
||||
caf::PdmChildField<RimRegularLegendConfig*> m_legendConfig;
|
||||
caf::PdmChildField<RimTernaryLegendConfig*> m_ternaryLegendConfig;
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "Rim2dIntersectionView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimExtrudedCurveIntersection.h"
|
||||
#include "RimGridView.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( Rim2dIntersectionViewCollection, "Intersection2dViewCollection" );
|
||||
|
||||
@ -88,23 +89,28 @@ void Rim2dIntersectionViewCollection::syncFromExistingIntersections( bool doUpda
|
||||
|
||||
for ( RimExtrudedCurveIntersection* intersection : allOrderedIntersectionsInCase )
|
||||
{
|
||||
auto view = intersection->firstAncestorOrThisOfType<RimGridView>();
|
||||
|
||||
auto it = intersectionToViewMap.find( intersection );
|
||||
if ( it == intersectionToViewMap.end() )
|
||||
{
|
||||
Rim2dIntersectionView* newView = new Rim2dIntersectionView();
|
||||
|
||||
auto view = intersection->firstAncestorOrThisOfType<Rim3dView>();
|
||||
if ( view )
|
||||
{
|
||||
newView->setCurrentTimeStep( view->currentTimeStep() );
|
||||
view->cellVisibilityChanged.connect( newView, &Rim2dIntersectionView::onCellVisibilityChanged );
|
||||
}
|
||||
|
||||
newView->setIntersection( intersection );
|
||||
|
||||
m_intersectionViews.push_back( newView );
|
||||
}
|
||||
else
|
||||
{
|
||||
view->cellVisibilityChanged.disconnect( it->second );
|
||||
m_intersectionViews.push_back( it->second );
|
||||
view->cellVisibilityChanged.connect( it->second, &Rim2dIntersectionView::onCellVisibilityChanged );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user