Enable filters for curve intersections (#10329)

* Enable cell filters
* Enable property filters
* Clean up fault collection interface and use similar setting for controlling filters as in intersection collection
* Enable cell/property filters on geomech intersections
* Enable cell and property filters for box intersections
This commit is contained in:
jonjenssen
2023-06-05 07:33:04 +02:00
committed by GitHub
parent 576156763a
commit 17f09878d2
36 changed files with 562 additions and 240 deletions

View File

@@ -70,9 +70,9 @@ bool RivBoxIntersectionGeometryGenerator::isAnyGeometryPresent() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivBoxIntersectionGeometryGenerator::generateSurface()
cvf::ref<cvf::DrawableGeo> RivBoxIntersectionGeometryGenerator::generateSurface( cvf::UByteArray* visibleCells )
{
calculateArrays();
calculateArrays( visibleCells );
CVF_ASSERT( m_triangleVxes.notNull() );
@@ -244,7 +244,7 @@ RimBoxIntersection* RivBoxIntersectionGeometryGenerator::intersectionBox() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivBoxIntersectionGeometryGenerator::calculateArrays()
void RivBoxIntersectionGeometryGenerator::calculateArrays( cvf::UByteArray* visibleCells )
{
if ( m_triangleVxes->size() ) return;
@@ -310,6 +310,7 @@ void RivBoxIntersectionGeometryGenerator::calculateArrays()
{
size_t globalCellIdx = columnCellCandidates[cccIdx];
if ( ( visibleCells != nullptr ) && ( ( *visibleCells )[globalCellIdx] == 0 ) ) continue;
if ( !m_hexGrid->useCell( globalCellIdx ) ) continue;
hexPlaneCutTriangleVxes.clear();

View File

@@ -46,7 +46,7 @@ public:
~RivBoxIntersectionGeometryGenerator() override;
// Generate geometry
cvf::ref<cvf::DrawableGeo> generateSurface();
cvf::ref<cvf::DrawableGeo> generateSurface( cvf::UByteArray* visibleCells );
cvf::ref<cvf::DrawableGeo> createMeshDrawable();
RimBoxIntersection* intersectionBox() const;
@@ -60,7 +60,7 @@ public:
const cvf::Vec3fArray* triangleVxes() const override;
private:
void calculateArrays();
void calculateArrays( cvf::UByteArray* visibleCells );
cvf::cref<RivIntersectionHexGridInterface> m_hexGrid;

View File

@@ -96,12 +96,12 @@ void RivBoxIntersectionPartMgr::updateCellResultColor( int timeStepIndex )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivBoxIntersectionPartMgr::generatePartGeometry()
void RivBoxIntersectionPartMgr::generatePartGeometry( cvf::UByteArray* visibleCells )
{
bool useBufferObjects = true;
// Surface geometry
{
cvf::ref<cvf::DrawableGeo> geo = m_intersectionBoxGenerator->generateSurface();
cvf::ref<cvf::DrawableGeo> geo = m_intersectionBoxGenerator->generateSurface( visibleCells );
if ( geo.notNull() )
{
geo->computeNormals();
@@ -187,11 +187,6 @@ void RivBoxIntersectionPartMgr::updatePartEffect()
//--------------------------------------------------------------------------------------------------
void RivBoxIntersectionPartMgr::appendNativeIntersectionFacesToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform )
{
if ( m_intersectionBoxFaces.isNull() && m_intersectionBoxGridLines.isNull() )
{
generatePartGeometry();
}
if ( m_intersectionBoxFaces.notNull() )
{
m_intersectionBoxFaces->setTransform( scaleTransform );
@@ -204,11 +199,6 @@ void RivBoxIntersectionPartMgr::appendNativeIntersectionFacesToModel( cvf::Model
//--------------------------------------------------------------------------------------------------
void RivBoxIntersectionPartMgr::appendMeshLinePartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform )
{
if ( m_intersectionBoxFaces.isNull() && m_intersectionBoxGridLines.isNull() )
{
generatePartGeometry();
}
if ( m_intersectionBoxGridLines.notNull() )
{
m_intersectionBoxGridLines->setTransform( scaleTransform );

View File

@@ -63,9 +63,10 @@ public:
const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const;
void generatePartGeometry( cvf::UByteArray* visibleCells );
private:
void updatePartEffect();
void generatePartGeometry();
private:
RimBoxIntersection* m_rimIntersectionBox;

View File

@@ -265,7 +265,7 @@ private:
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays( cvf::UByteArray* visibleCells )
{
if ( m_triangleVxes->size() ) return;
@@ -386,6 +386,7 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
for ( auto globalCellIdx : columnCellCandidates )
{
if ( ( visibleCells != nullptr ) && ( ( *visibleCells )[globalCellIdx] == 0 ) ) continue;
if ( !m_hexGrid->useCell( globalCellIdx ) ) continue;
hexPlaneCutTriangleVxes.clear();
@@ -618,9 +619,9 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays()
/// Generate surface drawable geo from the specified region
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivExtrudedCurveIntersectionGeometryGenerator::generateSurface()
cvf::ref<cvf::DrawableGeo> RivExtrudedCurveIntersectionGeometryGenerator::generateSurface( cvf::UByteArray* visibleCells )
{
calculateArrays();
calculateArrays( visibleCells );
CVF_ASSERT( m_triangleVxes.notNull() );
@@ -781,7 +782,7 @@ const cvf::Vec3fArray* RivExtrudedCurveIntersectionGeometryGenerator::faultMeshV
//--------------------------------------------------------------------------------------------------
void RivExtrudedCurveIntersectionGeometryGenerator::ensureGeometryIsCalculated()
{
calculateArrays();
calculateArrays( nullptr );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -60,7 +60,7 @@ public:
~RivExtrudedCurveIntersectionGeometryGenerator() override;
// Generate geometry
cvf::ref<cvf::DrawableGeo> generateSurface();
cvf::ref<cvf::DrawableGeo> generateSurface( cvf::UByteArray* visibleCells );
cvf::ref<cvf::DrawableGeo> createMeshDrawable();
cvf::ref<cvf::DrawableGeo> createFaultMeshDrawable();
@@ -87,7 +87,7 @@ public:
void ensureGeometryIsCalculated();
private:
void calculateArrays();
void calculateArrays( cvf::UByteArray* visibleCells );
void calculateLineSegementTransforms();
void calculateTransformedPolyline();
void calculateSurfaceIntersectionPoints();

View File

@@ -231,7 +231,7 @@ void RivIntersectionResultsColoringTools::calculateNodeOrElementNodeBasedGeoMech
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivExtrudedCurveIntersectionPartMgr::generatePartGeometry()
void RivExtrudedCurveIntersectionPartMgr::generatePartGeometry( cvf::UByteArray* visibleCells )
{
if ( m_intersectionGenerator.isNull() ) return;
@@ -242,7 +242,7 @@ void RivExtrudedCurveIntersectionPartMgr::generatePartGeometry()
bool useBufferObjects = true;
// Surface geometry
{
cvf::ref<cvf::DrawableGeo> geo = m_intersectionGenerator->generateSurface();
cvf::ref<cvf::DrawableGeo> geo = m_intersectionGenerator->generateSurface( visibleCells );
if ( geo.notNull() )
{
geo->computeNormals();
@@ -772,11 +772,6 @@ cvf::ref<cvf::Part> RivExtrudedCurveIntersectionPartMgr::createCurvePart( const
//--------------------------------------------------------------------------------------------------
void RivExtrudedCurveIntersectionPartMgr::appendIntersectionFacesToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform )
{
if ( m_intersectionFaces.isNull() )
{
generatePartGeometry();
}
if ( m_intersectionFaces.notNull() )
{
m_intersectionFaces->setTransform( scaleTransform );
@@ -789,11 +784,6 @@ void RivExtrudedCurveIntersectionPartMgr::appendIntersectionFacesToModel( cvf::M
//--------------------------------------------------------------------------------------------------
void RivExtrudedCurveIntersectionPartMgr::appendMeshLinePartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform )
{
if ( m_intersectionGridLines.isNull() )
{
generatePartGeometry();
}
if ( m_intersectionGridLines.notNull() )
{
m_intersectionGridLines->setTransform( scaleTransform );
@@ -873,7 +863,7 @@ void RivExtrudedCurveIntersectionPartMgr::appendPolylinePartsToModel( Rim3dView&
for ( size_t i = 0; i < m_annotationParts.size(); i++ )
{
auto part = m_annotationParts[i];
auto& part = m_annotationParts[i];
if ( part.notNull() )
{
part->setTransform( scaleTransform );

View File

@@ -20,13 +20,13 @@
#pragma once
#include "cvfArray.h"
#include "cvfCollection.h"
#include "cvfColor4.h"
#include "cvfMatrix4.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include "cafPdmPointer.h"
#include "cvfCollection.h"
#include <QString>
@@ -81,8 +81,9 @@ public:
const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const;
void generatePartGeometry( cvf::UByteArray* visibleCells );
private:
void generatePartGeometry();
void createFaultLabelParts( const std::vector<std::pair<QString, cvf::Vec3d>>& labelAndAnchors );
void createPolyLineParts( bool useBufferObjects );
void createExtrusionDirParts( bool useBufferObjects );

View File

@@ -859,7 +859,7 @@ void RivFaultPartMgr::updateNNCColors( size_t timeStepIndex, RimEclipseCellColor
cvf::ref<cvf::Effect> nncEffect;
if ( m_rimFaultCollection->showFaultFaces || m_rimFaultCollection->showOppositeFaultFaces )
if ( m_rimFaultCollection->showFaultFaces() || m_rimFaultCollection->showOppositeFaultFaces() )
{
// Move NNC closer to camera to avoid z-fighting with grid surface
caf::ScalarMapperEffectGenerator nncEffgen( mapper, caf::PO_NEG_LARGE );
@@ -901,7 +901,7 @@ void RivFaultPartMgr::updateNNCColors( size_t timeStepIndex, RimEclipseCellColor
CVF_ASSERT( nncColor.isValid() );
cvf::ref<cvf::Effect> nncEffect;
if ( m_rimFaultCollection->showFaultFaces || m_rimFaultCollection->showOppositeFaultFaces )
if ( m_rimFaultCollection->showFaultFaces() || m_rimFaultCollection->showOppositeFaultFaces() )
{
// Move NNC closer to camera to avoid z-fighting with grid surface
caf::SurfaceEffectGenerator nncEffgen( nncColor, caf::PO_NEG_LARGE );

View File

@@ -54,9 +54,9 @@ RivReservoirFaultsPartMgr::RivReservoirFaultsPartMgr( const RigMainGrid* grid, R
RimFaultInViewCollection* faultCollection = reservoirView->faultCollection();
if ( faultCollection )
{
for ( size_t i = 0; i < faultCollection->faults.size(); i++ )
for ( auto fault : faultCollection->faults() )
{
m_faultParts.push_back( new RivFaultPartMgr( grid, faultCollection, faultCollection->faults[i] ) );
m_faultParts.push_back( new RivFaultPartMgr( grid, faultCollection, fault ) );
}
}
}
@@ -86,9 +86,9 @@ void RivReservoirFaultsPartMgr::setCellVisibility( cvf::UByteArray* cellVisibili
{
CVF_ASSERT( cellVisibilities );
for ( size_t i = 0; i < m_faultParts.size(); i++ )
for ( auto& faultPart : m_faultParts )
{
m_faultParts.at( i )->setCellVisibility( cellVisibilities );
faultPart->setCellVisibility( cellVisibilities );
}
}
@@ -103,14 +103,14 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
if ( !faultCollection ) return;
bool isShowingGrid = m_reservoirView->isMainGridVisible();
if ( !faultCollection->showFaultCollection() && !isShowingGrid ) return;
if ( !faultCollection->isActive() && !isShowingGrid ) return;
// Check match between model fault count and fault parts
CVF_ASSERT( faultCollection->faults.size() == m_faultParts.size() );
CVF_ASSERT( faultCollection->faults().size() == m_faultParts.size() );
// Parts that is overridden by the grid settings
bool forceDisplayOfFault = false;
if ( !faultCollection->isShowingFaultsAndFaultsOutsideFilters() )
if ( faultCollection->shouldApplyCellFiltersToFaults() )
{
forceDisplayOfFault = isShowingGrid;
}
@@ -122,14 +122,13 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
cvf::ModelBasicList parts;
for ( size_t i = 0; i < faultCollection->faults.size(); i++ )
int i = 0;
for ( const auto rimFault : faultCollection->faults() )
{
const RimFaultInView* rimFault = faultCollection->faults[i];
cvf::ref<RivFaultPartMgr> rivFaultPart = m_faultParts[i];
cvf::ref<RivFaultPartMgr> rivFaultPart = m_faultParts[i++];
CVF_ASSERT( rivFaultPart.notNull() );
if ( ( faultCollection->showFaultCollection() && rimFault->showFault() ) || forceDisplayOfFault )
if ( ( faultCollection->isActive() && rimFault->showFault() ) || forceDisplayOfFault )
{
if ( faultCollection->showFaultFaces() || forceDisplayOfFault )
{
@@ -152,7 +151,7 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
RimEclipseFaultColors* faultResultColors = m_reservoirView->faultResultSettings();
RimEclipseCellColors* cellResultColors = m_reservoirView->cellResult();
if ( rimFault->showFault() && faultCollection->showFaultCollection() )
if ( rimFault->showFault() && faultCollection->isActive() )
{
if ( faultCollection->showNNCs() )
{
@@ -190,7 +189,7 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
}
}
if ( faultCollection->hideNncsWhenNoResultIsAvailable() )
if ( faultCollection->hideNNCsWhenNoResultIsAvailable() )
{
RigMainGrid* mainGrid = m_reservoirView->mainGrid();
if ( !( mainGrid && mainGrid->nncData()->hasScalarValues( eclipseResultAddress ) ) )
@@ -231,9 +230,9 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model )
//--------------------------------------------------------------------------------------------------
void RivReservoirFaultsPartMgr::applySingleColorEffect()
{
for ( size_t i = 0; i < m_faultParts.size(); i++ )
for ( auto& faultPart : m_faultParts )
{
m_faultParts[i]->applySingleColorEffect();
faultPart->applySingleColorEffect();
}
}
@@ -247,15 +246,15 @@ void RivReservoirFaultsPartMgr::updateColors( size_t timeStepIndex, RimEclipseCe
RimFaultInViewCollection* faultCollection = m_reservoirView->faultCollection();
CVF_ASSERT( faultCollection );
for ( size_t i = 0; i < faultCollection->faults.size(); i++ )
for ( auto& faultPart : m_faultParts )
{
if ( cellResultColors && ( cellResultColors->hasResult() || cellResultColors->isTernarySaturationSelected() ) )
{
m_faultParts[i]->updateCellResultColor( timeStepIndex, cellResultColors );
faultPart->updateCellResultColor( timeStepIndex, cellResultColors );
}
else
{
m_faultParts[i]->applySingleColorEffect();
faultPart->applySingleColorEffect();
}
}
}
@@ -267,9 +266,9 @@ void RivReservoirFaultsPartMgr::updateCellEdgeResultColor( size_t
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors )
{
for ( size_t i = 0; i < m_faultParts.size(); i++ )
for ( auto& faultPart : m_faultParts )
{
m_faultParts[i]->updateCellEdgeResultColor( timeStepIndex, cellResultColors, cellEdgeResultColors );
faultPart->updateCellEdgeResultColor( timeStepIndex, cellResultColors, cellEdgeResultColors );
}
}
@@ -284,20 +283,19 @@ void RivReservoirFaultsPartMgr::appendLabelPartsToModel( cvf::ModelBasicList* mo
RimFaultInViewCollection* faultCollection = m_reservoirView->faultCollection();
CVF_ASSERT( faultCollection );
if ( !faultCollection->showFaultCollection() ) return;
if ( !faultCollection->isActive() ) return;
if ( !faultCollection->showFaultLabel() ) return;
// Check match between model fault count and fault parts
CVF_ASSERT( faultCollection->faults.size() == m_faultParts.size() );
CVF_ASSERT( faultCollection->faults().size() == m_faultParts.size() );
cvf::ModelBasicList parts;
for ( size_t i = 0; i < faultCollection->faults.size(); i++ )
int i = 0;
for ( const auto rimFault : faultCollection->faults() )
{
const RimFaultInView* rimFault = faultCollection->faults[i];
cvf::ref<RivFaultPartMgr> rivFaultPart = m_faultParts[i];
cvf::ref<RivFaultPartMgr> rivFaultPart = m_faultParts[i++];
CVF_ASSERT( rivFaultPart.notNull() );
if ( rimFault->showFault() )
@@ -336,8 +334,8 @@ void RivReservoirFaultsPartMgr::clearWatertightGeometryFlag()
//--------------------------------------------------------------------------------------------------
void RivReservoirFaultsPartMgr::setOpacityLevel( float opacity )
{
for ( size_t i = 0; i < m_faultParts.size(); i++ )
for ( auto& faultPart : m_faultParts )
{
m_faultParts[i]->setOpacityLevel( opacity );
faultPart->setOpacityLevel( opacity );
}
}