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
@@ -62,40 +62,42 @@ RimFaultInViewCollection::RimFaultInViewCollection()
{
CAF_PDM_InitObject( "Faults", ":/draw_style_faults_24x24.png" );
CAF_PDM_InitField( &showFaultCollection, "Active", true, "Active" );
showFaultCollection.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &m_showFaultCollection, "Active", true, "Active" );
m_showFaultCollection.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &showFaultFaces, "ShowFaultFaces", true, "Show Defined faces" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &showFaultFaces );
CAF_PDM_InitField( &m_showFaultFaces, "ShowFaultFaces", true, "Show Defined faces" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showFaultFaces );
CAF_PDM_InitField( &showOppositeFaultFaces, "ShowOppositeFaultFaces", true, "Show Opposite Faces" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &showOppositeFaultFaces );
CAF_PDM_InitField( &m_showOppositeFaultFaces, "ShowOppositeFaultFaces", true, "Show Opposite Faces" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showOppositeFaultFaces );
CAF_PDM_InitField( &m_showFaultsOutsideFilters, "ShowFaultsOutsideFilters", true, "Show Faults Outside Filters" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showFaultsOutsideFilters );
CAF_PDM_InitField( &m_applyCellFilters, "ApplyCellFilters", true, "Use Cell Filters for Faults" );
CAF_PDM_InitField( &m_onlyShowWithNeighbor, "OnlyShowWithDefNeighbor", false, "Show Only Faces with Juxtaposition" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_onlyShowWithNeighbor );
CAF_PDM_InitField( &faultResult,
CAF_PDM_InitField( &m_faultResult,
"FaultFaceCulling",
caf::AppEnum<RimFaultInViewCollection::FaultFaceCullingMode>( RimFaultInViewCollection::FAULT_BACK_FACE_CULLING ),
"Dynamic Face Selection" );
CAF_PDM_InitField( &showFaultLabel, "ShowFaultLabel", false, "Show Labels" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &showFaultLabel );
CAF_PDM_InitField( &m_showFaultLabel, "ShowFaultLabel", false, "Show Labels" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showFaultLabel );
cvf::Color3f defWellLabelColor = RiaPreferences::current()->defaultWellLabelColor();
CAF_PDM_InitField( &faultLabelColor, "FaultLabelColor", defWellLabelColor, "Label Color" );
CAF_PDM_InitField( &m_faultLabelColor, "FaultLabelColor", defWellLabelColor, "Label Color" );
CAF_PDM_InitField( &showNNCs, "ShowNNCs", true, "Show NNCs" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &showNNCs );
CAF_PDM_InitField( &m_showNNCs, "ShowNNCs", true, "Show NNCs" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showNNCs );
CAF_PDM_InitField( &hideNncsWhenNoResultIsAvailable, "HideNncsWhenNoResultIsAvailable", true, "Hide NNC Geometry if No NNC Result is Available" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &hideNncsWhenNoResultIsAvailable );
CAF_PDM_InitField( &m_hideNNCsWhenNoResultIsAvailable,
"HideNncsWhenNoResultIsAvailable",
true,
"Hide NNC Geometry if No NNC Result is Available" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_hideNNCsWhenNoResultIsAvailable );
CAF_PDM_InitFieldNoDefault( &faults, "Faults", "Faults" );
faults.uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitFieldNoDefault( &m_faults, "Faults", "Faults" );
m_faults.uiCapability()->setUiTreeHidden( true );
}
//--------------------------------------------------------------------------------------------------
@@ -103,7 +105,79 @@ RimFaultInViewCollection::RimFaultInViewCollection()
//--------------------------------------------------------------------------------------------------
RimFaultInViewCollection::~RimFaultInViewCollection()
{
faults.deleteChildren();
m_faults.deleteChildren();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultInViewCollection::isActive() const
{
return m_showFaultCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultInViewCollection::setActive( bool bActive )
{
m_showFaultCollection = bActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimFaultInViewCollection::faultLabelColor() const
{
return m_faultLabelColor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::AppEnum<RimFaultInViewCollection::FaultFaceCullingMode> RimFaultInViewCollection::faultResult() const
{
return m_faultResult();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultInViewCollection::showFaultFaces() const
{
return m_showFaultFaces();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultInViewCollection::showFaultLabel() const
{
return m_showFaultLabel();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultInViewCollection::showOppositeFaultFaces() const
{
return m_showOppositeFaultFaces();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultInViewCollection::showNNCs() const
{
return m_showOppositeFaultFaces();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultInViewCollection::hideNNCsWhenNoResultIsAvailable() const
{
return m_hideNNCsWhenNoResultIsAvailable();
}
//--------------------------------------------------------------------------------------------------
@@ -113,7 +187,7 @@ void RimFaultInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* chan
{
this->updateUiIconFromToggleField();
if ( &faultLabelColor == changedField )
if ( &m_faultLabelColor == changedField )
{
parentView()->scheduleReservoirGridGeometryRegen();
parentView()->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
@@ -124,16 +198,16 @@ void RimFaultInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* chan
parentView()->scheduleReservoirGridGeometryRegen();
}
if ( &showFaultFaces == changedField || &showOppositeFaultFaces == changedField || &showFaultCollection == changedField ||
&showFaultLabel == changedField || &m_showFaultsOutsideFilters == changedField || &faultLabelColor == changedField ||
&m_onlyShowWithNeighbor == changedField || &faultResult == changedField || &showNNCs == changedField ||
&hideNncsWhenNoResultIsAvailable == changedField )
if ( &m_showFaultFaces == changedField || &m_showOppositeFaultFaces == changedField || &m_showFaultCollection == changedField ||
&m_showFaultLabel == changedField || &m_applyCellFilters == changedField || &m_faultLabelColor == changedField ||
&m_onlyShowWithNeighbor == changedField || &m_faultResult == changedField || &m_showNNCs == changedField ||
&m_hideNNCsWhenNoResultIsAvailable == changedField )
{
parentView()->scheduleCreateDisplayModelAndRedraw();
parentView()->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
}
if ( &showFaultLabel == changedField )
if ( &m_showFaultLabel == changedField )
{
RiuMainWindow::instance()->refreshDrawStyleActions();
}
@@ -144,7 +218,7 @@ void RimFaultInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* chan
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimFaultInViewCollection::objectToggleField()
{
return &showFaultCollection;
return &m_showFaultCollection;
}
//--------------------------------------------------------------------------------------------------
@@ -152,12 +226,9 @@ caf::PdmFieldHandle* RimFaultInViewCollection::objectToggleField()
//--------------------------------------------------------------------------------------------------
RimFaultInView* RimFaultInViewCollection::findFaultByName( QString name )
{
for ( size_t i = 0; i < this->faults().size(); ++i )
for ( auto& fault : m_faults )
{
if ( this->faults()[i]->name() == name )
{
return this->faults()[i];
}
if ( fault->name() == name ) return fault;
}
return nullptr;
}
@@ -250,8 +321,8 @@ void RimFaultInViewCollection::syncronizeFaults()
newFaults.push_back( rimFault );
}
this->faults().clearWithoutDelete();
this->faults().insert( 0, newFaults );
m_faults().clearWithoutDelete();
m_faults().insert( 0, newFaults );
QString toolTip = QString( "Fault count (%1)" ).arg( newFaults.size() );
setUiToolTip( toolTip );
@@ -272,21 +343,21 @@ void RimFaultInViewCollection::uiOrderingFaults( QString uiConfigName, caf::PdmU
{
bool isGridVizMode = isGridVisualizationMode();
faultResult.uiCapability()->setUiReadOnly( isGridVizMode );
showFaultFaces.uiCapability()->setUiReadOnly( isGridVizMode );
showOppositeFaultFaces.uiCapability()->setUiReadOnly( isGridVizMode );
m_faultResult.uiCapability()->setUiReadOnly( isGridVizMode );
m_showFaultFaces.uiCapability()->setUiReadOnly( isGridVizMode );
m_showOppositeFaultFaces.uiCapability()->setUiReadOnly( isGridVizMode );
caf::PdmUiGroup* ffviz = uiOrdering.addNewGroup( "Fault Face Visibility" );
ffviz->setCollapsedByDefault();
ffviz->add( &showFaultFaces );
ffviz->add( &showOppositeFaultFaces );
ffviz->add( &faultResult );
ffviz->add( &m_showFaultFaces );
ffviz->add( &m_showOppositeFaultFaces );
ffviz->add( &m_faultResult );
ffviz->add( &m_onlyShowWithNeighbor );
caf::PdmUiGroup* nncViz = uiOrdering.addNewGroup( "NNC Visibility" );
nncViz->setCollapsedByDefault();
nncViz->add( &showNNCs );
nncViz->add( &hideNncsWhenNoResultIsAvailable );
nncViz->add( &m_showNNCs );
nncViz->add( &m_hideNNCsWhenNoResultIsAvailable );
}
//--------------------------------------------------------------------------------------------------
@@ -294,12 +365,12 @@ void RimFaultInViewCollection::uiOrderingFaults( QString uiConfigName, caf::PdmU
//--------------------------------------------------------------------------------------------------
void RimFaultInViewCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* labs = uiOrdering.addNewGroup( "Fault Labels" );
labs->add( &showFaultLabel );
labs->add( &faultLabelColor );
caf::PdmUiGroup* general = uiOrdering.addNewGroup( "General" );
general->add( &m_applyCellFilters );
caf::PdmUiGroup* adv = uiOrdering.addNewGroup( "Fault Options" );
adv->add( &m_showFaultsOutsideFilters );
caf::PdmUiGroup* labs = uiOrdering.addNewGroup( "Fault Labels" );
labs->add( &m_showFaultLabel );
labs->add( &m_faultLabelColor );
uiOrderingFaults( uiConfigName, uiOrdering );
}
@@ -316,7 +387,7 @@ void RimFaultInViewCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiT
uiTreeOrdering.appendChild( uiTree );
}
for ( const auto& fault : faults )
for ( const auto& fault : m_faults )
{
uiTreeOrdering.add( fault );
}
@@ -335,19 +406,11 @@ RimEclipseView* RimFaultInViewCollection::parentView() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultInViewCollection::isShowingFaultsAndFaultsOutsideFilters() const
bool RimFaultInViewCollection::shouldApplyCellFiltersToFaults() const
{
if ( !showFaultCollection ) return false;
if ( !m_showFaultCollection() ) return false;
return m_showFaultsOutsideFilters;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultInViewCollection::setShowFaultsOutsideFilter( bool show )
{
m_showFaultsOutsideFilters = show;
return m_applyCellFilters;
}
//--------------------------------------------------------------------------------------------------
@@ -357,3 +420,43 @@ bool RimFaultInViewCollection::onlyShowFacesWithDefinedNeighbor() const
{
return m_onlyShowWithNeighbor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimFaultInView*> RimFaultInViewCollection::faults() const
{
return m_faults.childrenByType();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultInViewCollection::setFaultResult( caf::AppEnum<FaultFaceCullingMode> resultType )
{
m_faultResult = resultType;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultInViewCollection::setShouldApplyCellFiltersToFaults( bool bEnabled )
{
m_applyCellFilters = bEnabled;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultInViewCollection::setShowOppositeFaultFaces( bool bEnabled )
{
m_showOppositeFaultFaces = bEnabled;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultInViewCollection::setShowFaultLabelWithFieldChanged( bool bEnabled )
{
m_showFaultLabel.setValueWithFieldChanged( bEnabled );
}
@@ -31,6 +31,8 @@
#include <QString>
#include <vector>
class RimEclipseView;
class RimFaultInView;
@@ -54,29 +56,30 @@ public:
RimFaultInViewCollection();
~RimFaultInViewCollection() override;
bool isActive() const;
void setActive( bool bActive );
std::vector<RimFaultInView*> faults() const;
cvf::Color3f faultLabelColor() const;
caf::AppEnum<FaultFaceCullingMode> faultResult() const;
bool showFaultFaces() const;
bool showFaultLabel() const;
bool showOppositeFaultFaces() const;
bool showNNCs() const;
bool hideNNCsWhenNoResultIsAvailable() const;
void setFaultResult( caf::AppEnum<FaultFaceCullingMode> resultType );
void setShouldApplyCellFiltersToFaults( bool bEnabled );
void setShowOppositeFaultFaces( bool bEnabled );
void setShowFaultLabelWithFieldChanged( bool bEnabled );
void syncronizeFaults();
bool isGridVisualizationMode() const;
bool isShowingFaultsAndFaultsOutsideFilters() const;
void setShowFaultsOutsideFilter( bool show );
bool shouldApplyCellFiltersToFaults() const;
bool onlyShowFacesWithDefinedNeighbor() const;
caf::PdmField<bool> showFaultFaces;
caf::PdmField<bool> showOppositeFaultFaces;
caf::PdmField<caf::AppEnum<FaultFaceCullingMode>> faultResult;
caf::PdmField<bool> showFaultLabel;
caf::PdmField<cvf::Color3f> faultLabelColor;
caf::PdmField<bool> showFaultCollection;
caf::PdmField<bool> showNNCs;
caf::PdmField<bool> hideNncsWhenNoResultIsAvailable;
caf::PdmChildArrayField<RimFaultInView*> faults;
RimFaultInView* findFaultByName( QString name );
RimFaultInView* findFaultByName( QString name );
void uiOrderingFaults( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
@@ -90,6 +93,19 @@ private:
RimEclipseView* parentView() const;
private:
caf::PdmField<bool> m_showFaultsOutsideFilters;
caf::PdmField<bool> m_onlyShowWithNeighbor;
caf::PdmField<bool> m_showFaultsOutsideFilters_obsolete;
caf::PdmField<bool> m_applyCellFilters;
caf::PdmField<bool> m_onlyShowWithNeighbor;
caf::PdmField<bool> m_showFaultFaces;
caf::PdmField<bool> m_showOppositeFaultFaces;
caf::PdmField<bool> m_showFaultLabel;
caf::PdmField<cvf::Color3f> m_faultLabelColor;
caf::PdmField<bool> m_showFaultCollection;
caf::PdmField<bool> m_showNNCs;
caf::PdmField<bool> m_hideNNCsWhenNoResultIsAvailable;
caf::PdmField<caf::AppEnum<FaultFaceCullingMode>> m_faultResult;
caf::PdmChildArrayField<RimFaultInView*> m_faults;
};
@@ -537,7 +537,7 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch
if ( view != nullptr )
{
view->faultCollection()->showFaultCollection = false;
view->faultCollection()->setActive( false );
view->cellResult()->setResultType( RiaDefines::ResultCatType::FLOW_DIAGNOSTICS );
view->cellResult()->setFlowDiagTracerSelectionType(
RimEclipseResultDefinition::FlowTracerSelectionType::FLOW_TR_BY_SELECTION );
@@ -667,7 +667,6 @@ void RimFlowCharacteristicsPlot::onLoadDataAndUpdate()
if ( m_cellFilter() == RigFlowDiagResults::CELLS_VISIBLE )
{
cvf::UByteArray visibleCells;
m_case()->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
if ( m_cellFilterView )
{
@@ -318,12 +318,9 @@ void RimGeoMechView::onCreateDisplayModel()
nativeOrOverrideViewer()->addStaticModelOnce( m_wellPathPipeVizModel.p(), isUsingOverrideViewer() );
// Cross sections
// Intersections
m_intersectionVizModel->removeAllParts();
m_intersectionCollection->rebuildGeometry();
m_intersectionCollection->appendPartsToModel( *this, m_intersectionVizModel.p(), scaleTransform() );
nativeOrOverrideViewer()->addStaticModelOnce( m_intersectionVizModel.p(), isUsingOverrideViewer() );
appendIntersectionsToModel( cellFilterCollection()->hasActiveFilters(), propertyFilterCollection()->hasActiveDynamicFilters() );
// Seismic sections
@@ -480,13 +477,14 @@ void RimGeoMechView::onUpdateDisplayModelForCurrentTimeStep()
m_vizLogic->updateStaticCellColors( m_currentTimeStep() );
// Intersections
if ( intersectionCollection()->shouldApplyCellFiltersToIntersections() && propertyFilterCollection()->hasActiveDynamicFilters() )
{
m_intersectionVizModel->removeAllParts();
m_intersectionCollection->rebuildGeometry();
m_intersectionCollection->appendPartsToModel( *this, m_intersectionVizModel.p(), scaleTransform() );
m_intersectionCollection->updateCellResultColor( hasGeneralCellResult, m_currentTimeStep );
m_intersectionCollection->clearGeometry();
appendIntersectionsForCurrentTimeStep();
}
m_intersectionCollection->updateCellResultColor( hasGeneralCellResult, m_currentTimeStep );
if ( m_surfaceCollection )
{
m_surfaceCollection->updateCellResultColor( hasGeneralCellResult, m_currentTimeStep );
@@ -1133,3 +1131,12 @@ void RimGeoMechView::resetVizLogic()
m_vizLogic->resetPartMgrs();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechView::calculateCellVisibility( cvf::UByteArray* visibility, std::vector<RivCellSetEnum> geomTypes, int viewerTimeStep )
{
CAF_ASSERT( m_vizLogic.notNull() );
m_vizLogic->calculateCellVisibility( visibility, geomTypes, viewerTimeStep );
}
@@ -128,6 +128,8 @@ protected:
RimPropertyFilterCollection* nativePropertyFilterCollection();
void calculateCellVisibility( cvf::UByteArray* visibility, std::vector<RivCellSetEnum> geomTypes, int timeStep = 0 ) override;
private:
QString createAutoName() const override;
@@ -267,7 +267,7 @@ void RimBoxIntersection::appendManipulatorPartsToModel( cvf::ModelBasicList* mod
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimBoxIntersection::rebuildGeometry()
void RimBoxIntersection::clearGeometry()
{
m_intersectionBoxPartMgr = nullptr;
}
@@ -73,7 +73,7 @@ public:
RivBoxIntersectionPartMgr* intersectionBoxPartMgr();
void appendManipulatorPartsToModel( cvf::ModelBasicList* model );
void rebuildGeometry();
void clearGeometry();
void setToDefaultSizeBox();
void setToDefaultSizeSlice( SinglePlaneState plane, const cvf::Vec3d& position );
@@ -844,7 +844,7 @@ RivExtrudedCurveIntersectionPartMgr* RimExtrudedCurveIntersection::intersectionP
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimExtrudedCurveIntersection::rebuildGeometry()
void RimExtrudedCurveIntersection::clearGeometry()
{
m_crossSectionPartMgr = nullptr;
}
@@ -109,7 +109,7 @@ public:
Rim2dIntersectionView* correspondingIntersectionView() const;
RivExtrudedCurveIntersectionPartMgr* intersectionPartMgr();
void rebuildGeometry();
void clearGeometry();
const RivIntersectionGeometryGeneratorInterface* intersectionGeometryGenerator() const override;
std::vector<cvf::Vec3d> polyLinesForExtrusionDirection() const;
@@ -42,6 +42,7 @@
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiDoubleSliderEditor.h"
#include "cafPdmUiTreeOrdering.h"
#include "cvfModelBasicList.h"
CAF_PDM_SOURCE_INIT( RimIntersectionCollection, "IntersectionCollection", "CrossSectionCollection" );
@@ -59,8 +60,8 @@ RimIntersectionCollection::RimIntersectionCollection()
CAF_PDM_InitFieldNoDefault( &m_intersectionBoxes, "IntersectionBoxes", "IntersectionBoxes" );
m_intersectionBoxes.uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitField( &isActive, "Active", true, "Active" );
isActive.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &m_isActive, "Active", true, "Active" );
m_isActive.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_depthUpperThreshold, "UpperDepthThreshold", "Upper Threshold" );
m_depthUpperThreshold.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
@@ -75,6 +76,8 @@ RimIntersectionCollection::RimIntersectionCollection()
CAF_PDM_InitField( &m_kFilterOverridden, "OverrideKFilter", false, "Override K Range Filter" );
CAF_PDM_InitFieldNoDefault( &m_kFilterStr, "KRangeFilter", "K Range Filter", "", "Example: 2,4-6,10-30:2", "" );
CAF_PDM_InitField( &m_applyCellFilters, "ApplyCellFilters", true, "Use Cell Filters" );
}
//--------------------------------------------------------------------------------------------------
@@ -91,7 +94,15 @@ RimIntersectionCollection::~RimIntersectionCollection()
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimIntersectionCollection::objectToggleField()
{
return &isActive;
return &m_isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimIntersectionCollection::isActive() const
{
return m_isActive();
}
//--------------------------------------------------------------------------------------------------
@@ -209,9 +220,36 @@ void RimIntersectionCollection::appendPartsToModel( Rim3dView& view, cvf::ModelB
{
if ( cs->isActive() )
{
cs->intersectionPartMgr()->appendPolylinePartsToModel( view, model, scaleTransform );
}
}
for ( RimBoxIntersection* cs : m_intersectionBoxes )
{
if ( cs->isActive() && cs->show3dManipulator() )
{
cs->appendManipulatorPartsToModel( model );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::appendDynamicPartsToModel( cvf::ModelBasicList* model,
cvf::Transform* scaleTransform,
size_t timeStepIndex,
cvf::UByteArray* visibleCells )
{
if ( !isActive() ) return;
for ( RimExtrudedCurveIntersection* cs : m_intersections )
{
if ( cs->isActive() )
{
cs->intersectionPartMgr()->generatePartGeometry( visibleCells );
cs->intersectionPartMgr()->appendIntersectionFacesToModel( model, scaleTransform );
cs->intersectionPartMgr()->appendMeshLinePartsToModel( model, scaleTransform );
cs->intersectionPartMgr()->appendPolylinePartsToModel( view, model, scaleTransform );
}
}
@@ -219,32 +257,26 @@ void RimIntersectionCollection::appendPartsToModel( Rim3dView& view, cvf::ModelB
{
if ( cs->isActive() )
{
cs->intersectionBoxPartMgr()->generatePartGeometry( visibleCells );
cs->intersectionBoxPartMgr()->appendNativeIntersectionFacesToModel( model, scaleTransform );
cs->intersectionBoxPartMgr()->appendMeshLinePartsToModel( model, scaleTransform );
if ( cs->show3dManipulator() )
{
cs->appendManipulatorPartsToModel( model );
}
}
}
model->updateBoundingBoxesRecursive();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::rebuildGeometry()
void RimIntersectionCollection::clearGeometry()
{
for ( RimExtrudedCurveIntersection* intersection : m_intersections )
{
intersection->rebuildGeometry();
intersection->clearGeometry();
}
for ( RimBoxIntersection* intersectionBox : m_intersectionBoxes )
{
intersectionBox->rebuildGeometry();
intersectionBox->clearGeometry();
}
}
@@ -354,12 +386,12 @@ void RimIntersectionCollection::fieldChangedByUi( const caf::PdmFieldHandle* cha
{
bool rebuildView = false;
if ( changedField == &isActive )
if ( changedField == &m_isActive )
{
updateUiIconFromToggleField();
rebuildView = true;
}
if ( changedField == &m_depthThresholdOverridden )
else if ( changedField == &m_depthThresholdOverridden )
{
for ( RimExtrudedCurveIntersection* cs : m_intersections )
{
@@ -372,8 +404,8 @@ void RimIntersectionCollection::fieldChangedByUi( const caf::PdmFieldHandle* cha
}
rebuildView = true;
}
if ( ( changedField == &m_depthUpperThreshold ) || ( changedField == &m_depthLowerThreshold ) || ( changedField == &m_depthFilterType ) )
else if ( ( changedField == &m_depthUpperThreshold ) || ( changedField == &m_depthLowerThreshold ) ||
( changedField == &m_depthFilterType ) )
{
for ( RimExtrudedCurveIntersection* cs : m_intersections )
{
@@ -382,8 +414,7 @@ void RimIntersectionCollection::fieldChangedByUi( const caf::PdmFieldHandle* cha
}
rebuildView = true;
}
if ( changedField == &m_kFilterOverridden || changedField == &m_kFilterStr )
else if ( changedField == &m_kFilterOverridden || changedField == &m_kFilterStr )
{
for ( RimExtrudedCurveIntersection* cs : m_intersections )
{
@@ -392,6 +423,10 @@ void RimIntersectionCollection::fieldChangedByUi( const caf::PdmFieldHandle* cha
}
rebuildView = true;
}
else if ( changedField == &m_applyCellFilters )
{
rebuildView = true;
}
if ( rebuildView )
{
@@ -452,7 +487,11 @@ void RimIntersectionCollection::updateIntersectionBoxGeometry()
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* genGroup = uiOrdering.addNewGroup( "General" );
genGroup->add( &m_applyCellFilters );
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup( "Depth Filter - Curve Intersections" );
filterGroup->setCollapsedByDefault();
m_depthFilterType.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() );
m_depthUpperThreshold.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() );
@@ -486,12 +525,13 @@ void RimIntersectionCollection::defineUiOrdering( QString uiConfigName, caf::Pdm
}
if ( eclipseView() )
{
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup( "K Filter - Curve Intersections" );
caf::PdmUiGroup* kfilterGroup = uiOrdering.addNewGroup( "K Filter - Curve Intersections" );
kfilterGroup->setCollapsedByDefault();
m_kFilterStr.uiCapability()->setUiReadOnly( !m_kFilterOverridden() );
filterGroup->add( &m_kFilterOverridden );
filterGroup->add( &m_kFilterStr );
kfilterGroup->add( &m_kFilterOverridden );
kfilterGroup->add( &m_kFilterStr );
}
uiOrdering.skipRemainingFields( true );
@@ -539,3 +579,11 @@ void RimIntersectionCollection::rebuild3dView() const
rimView->scheduleCreateDisplayModelAndRedraw();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimIntersectionCollection::shouldApplyCellFiltersToIntersections() const
{
return m_applyCellFilters();
}
@@ -23,6 +23,8 @@
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cvfArray.h"
#include "RimIntersectionEnums.h"
class Rim3dView;
@@ -53,8 +55,6 @@ public:
RimIntersectionCollection();
~RimIntersectionCollection() override;
caf::PdmField<bool> isActive;
void appendIntersectionAndUpdate( RimExtrudedCurveIntersection* intersection, bool allowActiveViewChange = true );
void appendIntersectionNoUpdate( RimExtrudedCurveIntersection* intersection );
@@ -70,12 +70,18 @@ public:
void scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
void recomputeSimWellBranchData();
bool shouldApplyCellFiltersToIntersections() const;
// Visualization interface
void applySingleColorEffect();
void updateCellResultColor( bool hasGeneralCellResult, int timeStepIndex );
void appendPartsToModel( Rim3dView& view, cvf::ModelBasicList* model, cvf::Transform* scaleTransform );
void rebuildGeometry();
void appendDynamicPartsToModel( cvf::ModelBasicList* model,
cvf::Transform* scaleTransform,
size_t timeStepIndex,
cvf::UByteArray* visibleCells = nullptr );
void clearGeometry();
std::vector<RimExtrudedCurveIntersection*> intersections() const;
std::vector<RimBoxIntersection*> intersectionBoxes() const;
@@ -84,6 +90,8 @@ public:
void onChildAdded( caf::PdmFieldHandle* containerForNewObject ) override;
bool isActive() const;
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
caf::PdmFieldHandle* objectToggleField() override;
@@ -96,6 +104,8 @@ private:
RimEclipseView* eclipseView() const;
void rebuild3dView() const;
caf::PdmField<bool> m_isActive;
caf::PdmChildArrayField<RimExtrudedCurveIntersection*> m_intersections;
caf::PdmChildArrayField<RimBoxIntersection*> m_intersectionBoxes;
@@ -104,6 +114,8 @@ private:
caf::PdmField<double> m_depthLowerThreshold;
caf::PdmField<caf::AppEnum<RimIntersectionFilterEnum>> m_depthFilterType;
caf::PdmField<bool> m_applyCellFilters;
caf::PdmField<bool> m_kFilterOverridden;
caf::PdmField<QString> m_kFilterStr;
};
@@ -539,6 +539,7 @@ void Rim2dIntersectionView::onCreateDisplayModel()
m_intersectionVizModel->removeAllParts();
m_flatIntersectionPartMgr->generatePartGeometry( nullptr );
m_flatIntersectionPartMgr->appendIntersectionFacesToModel( m_intersectionVizModel.p(), scaleTransform() );
m_flatIntersectionPartMgr->appendMeshLinePartsToModel( m_intersectionVizModel.p(), scaleTransform() );
m_flatIntersectionPartMgr->appendPolylinePartsToModel( *this, m_intersectionVizModel.p(), scaleTransform() );
@@ -150,9 +150,6 @@ Rim3dView::Rim3dView()
CAF_PDM_InitFieldNoDefault( &m_fontSize, "FontSize", "Font Size" );
m_intersectionVizModel = new cvf::ModelBasicList;
m_intersectionVizModel->setName( "CrossSectionModel" );
m_seismicVizModel = new cvf::ModelBasicList;
m_seismicVizModel->setName( "SeismicSectionModel" );
@@ -257,7 +257,6 @@ protected:
// 3D display model data
cvf::ref<cvf::ModelBasicList> m_wellPathPipeVizModel;
cvf::ref<cvf::ModelBasicList> m_intersectionVizModel;
cvf::ref<cvf::ModelBasicList> m_seismicVizModel;
cvf::ref<RivWellPathsPartMgr> m_wellPathsPartManager;
@@ -311,8 +311,8 @@ RimEclipseView* RimEclipseCase::createAndAddReservoirView()
rimEclipseView->cellResult()->setFromEclipseResultAddress( defaultResult );
}
auto prefs = RiaPreferences::current();
rimEclipseView->faultCollection()->showFaultCollection = prefs->enableFaultsByDefault();
auto prefs = RiaPreferences::current();
rimEclipseView->faultCollection()->setActive( prefs->enableFaultsByDefault() );
rimEclipseView->cellEdgeResult()->setResultVariable( "MULT" );
rimEclipseView->cellEdgeResult()->setActive( false );
@@ -291,9 +291,9 @@ void RimEclipseContourMapView::updateGeometry()
//--------------------------------------------------------------------------------------------------
void RimEclipseContourMapView::setFaultVisParameters()
{
faultCollection()->setShowFaultsOutsideFilter( false );
faultCollection()->showOppositeFaultFaces = true;
faultCollection()->faultResult = RimFaultInViewCollection::FAULT_NO_FACE_CULLING;
faultCollection()->setShouldApplyCellFiltersToFaults( true );
faultCollection()->setShowOppositeFaultFaces( true );
faultCollection()->setFaultResult( RimFaultInViewCollection::FAULT_NO_FACE_CULLING );
faultResultSettings()->showCustomFaultResult = true;
faultResultSettings()->customFaultResult()->setResultVariable( "None" );
}
@@ -507,7 +507,7 @@ std::set<RivCellSetEnum> RimEclipseContourMapView::allVisibleFaultGeometryTypes(
{
std::set<RivCellSetEnum> faultGeoTypes;
// Normal eclipse views always shows faults for active and visible eclipse cells.
if ( faultCollection()->showFaultCollection() )
if ( faultCollection()->isActive() )
{
faultGeoTypes = RimEclipseView::allVisibleFaultGeometryTypes();
}
@@ -439,6 +439,9 @@ void RimEclipseView::onCreateDisplayModel()
if ( !( m_eclipseCase && m_eclipseCase->eclipseCaseData() ) ) return;
const bool cellFiltersActive = cellFilterCollection()->hasActiveFilters();
const bool propertyFiltersActive = eclipsePropertyFilterCollection()->hasActiveFilters();
// Define a vector containing time step indices to produce geometry for.
// First entry in this vector is used to define the geometry only result mode with no results.
std::vector<size_t> timeStepIndices;
@@ -458,9 +461,9 @@ void RimEclipseView::onCreateDisplayModel()
timeStepIndices.push_back( i );
}
}
else if ( this->cellResult()->hasStaticResult() || this->cellEdgeResult()->hasResult() ||
this->eclipsePropertyFilterCollection()->hasActiveFilters() || this->intersectionCollection()->hasAnyActiveSeparateResults() ||
( this->surfaceInViewCollection() && this->surfaceInViewCollection()->hasAnyActiveSeparateResults() ) )
else if ( cellResult()->hasStaticResult() || cellEdgeResult()->hasResult() || propertyFiltersActive ||
intersectionCollection()->hasAnyActiveSeparateResults() ||
( surfaceInViewCollection() && surfaceInViewCollection()->hasAnyActiveSeparateResults() ) )
{
// The one and only static result entry
timeStepIndices.push_back( 0 );
@@ -480,7 +483,7 @@ void RimEclipseView::onCreateDisplayModel()
wellCollection()->scheduleIsWellPipesVisibleRecalculation();
// Create vector of grid indices to render
std::vector<size_t> gridIndices = this->indicesToVisibleGrids();
std::vector<size_t> gridIndices = indicesToVisibleGrids();
///
// Get or create the parts for "static" type geometry. The same geometry is used
@@ -488,36 +491,35 @@ void RimEclipseView::onCreateDisplayModel()
// For property filtered geometry : just set all the models as empty scenes
// updateCurrentTimeStep requests the actual parts
if ( !this->eclipsePropertyFilterCollection()->hasActiveFilters() ||
( this->viewController() && this->viewController()->isVisibleCellsOveridden() ) )
if ( !propertyFiltersActive || ( viewController() && viewController()->isVisibleCellsOveridden() ) )
{
std::vector<RivCellSetEnum> geometryTypesToAdd;
if ( this->viewController() && this->viewController()->isVisibleCellsOveridden() )
if ( viewController() && viewController()->isVisibleCellsOveridden() )
{
geometryTypesToAdd.push_back( OVERRIDDEN_CELL_VISIBILITY );
}
else if ( this->cellFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells() )
else if ( cellFiltersActive && wellCollection()->hasVisibleWellCells() )
{
geometryTypesToAdd.push_back( RANGE_FILTERED );
geometryTypesToAdd.push_back( RANGE_FILTERED_WELL_CELLS );
geometryTypesToAdd.push_back( VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER );
geometryTypesToAdd.push_back( VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER );
if ( this->showInactiveCells() )
if ( showInactiveCells() )
{
geometryTypesToAdd.push_back( RANGE_FILTERED_INACTIVE );
}
}
else if ( !this->cellFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells() )
else if ( !cellFiltersActive && wellCollection()->hasVisibleWellCells() )
{
geometryTypesToAdd.push_back( VISIBLE_WELL_CELLS );
geometryTypesToAdd.push_back( VISIBLE_WELL_FENCE_CELLS );
}
else if ( this->cellFilterCollection()->hasActiveFilters() && !this->wellCollection()->hasVisibleWellCells() )
else if ( cellFiltersActive && !wellCollection()->hasVisibleWellCells() )
{
geometryTypesToAdd.push_back( RANGE_FILTERED );
geometryTypesToAdd.push_back( RANGE_FILTERED_WELL_CELLS );
if ( this->showInactiveCells() )
if ( showInactiveCells() )
{
geometryTypesToAdd.push_back( RANGE_FILTERED_INACTIVE );
}
@@ -527,7 +529,7 @@ void RimEclipseView::onCreateDisplayModel()
geometryTypesToAdd.push_back( ALL_WELL_CELLS ); // Should be all well cells
geometryTypesToAdd.push_back( ACTIVE );
if ( this->showInactiveCells() )
if ( showInactiveCells() )
{
geometryTypesToAdd.push_back( INACTIVE );
}
@@ -555,7 +557,7 @@ void RimEclipseView::onCreateDisplayModel()
}
}
// Set static colors
this->onUpdateStaticCellColors();
onUpdateStaticCellColors();
}
else
{
@@ -565,14 +567,14 @@ void RimEclipseView::onCreateDisplayModel()
m_reservoirGridPartManager->clearWatertightGeometryFlags();
if ( faultCollection()->showFaultCollection() || !this->eclipsePropertyFilterCollection()->hasActiveFilters() )
if ( faultCollection()->isActive() || !propertyFiltersActive )
{
setVisibleGridPartsWatertight();
std::set<RivCellSetEnum> faultGeometryTypesToAppend = allVisibleFaultGeometryTypes();
RivCellSetEnum faultLabelType =
m_reservoirGridPartManager->geometryTypeForFaultLabels( faultGeometryTypesToAppend,
faultCollection()->isShowingFaultsAndFaultsOutsideFilters() );
!faultCollection()->shouldApplyCellFiltersToFaults() );
for ( size_t frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx )
{
@@ -587,22 +589,16 @@ void RimEclipseView::onCreateDisplayModel()
}
}
// Cross sections
m_intersectionVizModel->removeAllParts();
m_intersectionCollection->rebuildGeometry();
m_intersectionCollection->appendPartsToModel( *this, m_intersectionVizModel.p(), m_reservoirGridPartManager->scaleTransform() );
nativeOrOverrideViewer()->addStaticModelOnce( m_intersectionVizModel.p(), isUsingOverrideViewer() );
// Intersections
appendIntersectionsToModel( cellFiltersActive, propertyFiltersActive );
// Seismic sections
cvf::ref<caf::DisplayCoordTransform> transform = displayCoordTransform();
m_seismicVizModel->removeAllParts();
m_seismicSectionCollection->appendPartsToModel( this, m_seismicVizModel.p(), transform.p(), ownerCase()->allCellsBoundingBox() );
nativeOrOverrideViewer()->addStaticModelOnce( m_seismicVizModel.p(), isUsingOverrideViewer() );
// Surfaces
m_surfaceVizModel->removeAllParts();
if ( surfaceInViewCollection() )
{
@@ -611,7 +607,6 @@ void RimEclipseView::onCreateDisplayModel()
}
// Well path model
m_wellPathPipeVizModel->removeAllParts();
// NB! StimPlan legend colors must be updated before well path geometry is added to the model
@@ -659,7 +654,7 @@ void RimEclipseView::onCreateDisplayModel()
updateFaultColors();
}
std::vector<RimFlowCharacteristicsPlot*> characteristicsPlots = this->objectsWithReferringPtrFieldsOfType<RimFlowCharacteristicsPlot>();
std::vector<RimFlowCharacteristicsPlot*> characteristicsPlots = objectsWithReferringPtrFieldsOfType<RimFlowCharacteristicsPlot>();
for ( auto plot : characteristicsPlots )
{
if ( plot != nullptr )
@@ -711,8 +706,6 @@ void RimEclipseView::onUpdateDisplayModelForCurrentTimeStep()
{
clearReservoirCellVisibilities();
// m_surfaceCollection->clearGeometry();
m_propertyFilterCollection()->updateFromCurrentTimeStep();
m_streamlineCollection()->updateFromCurrentTimeStep( currentTimeStep() );
@@ -720,6 +713,12 @@ void RimEclipseView::onUpdateDisplayModelForCurrentTimeStep()
onUpdateLegends(); // To make sure the scalar mappers are set up correctly
if ( intersectionCollection()->shouldApplyCellFiltersToIntersections() && eclipsePropertyFilterCollection()->hasActiveFilters() )
{
m_intersectionCollection->clearGeometry();
appendIntersectionsForCurrentTimeStep();
}
updateVisibleCellColors();
wellCollection()->scaleWellDisks();
@@ -787,7 +786,7 @@ void RimEclipseView::updateVisibleGeometries()
RivCellSetEnum faultLabelType =
m_reservoirGridPartManager->geometryTypeForFaultLabels( faultGeometryTypesToAppend,
faultCollection()->isShowingFaultsAndFaultsOutsideFilters() );
!faultCollection()->shouldApplyCellFiltersToFaults() );
if ( faultLabelType == PROPERTY_FILTERED )
{
m_reservoirGridPartManager->appendFaultLabelsDynamicGeometryPartsToModel( frameParts.p(), faultLabelType, m_currentTimeStep );
@@ -810,7 +809,7 @@ void RimEclipseView::updateVisibleGeometries()
{
m_reservoirGridPartManager->appendStaticGeometryPartsToModel( frameParts.p(), RANGE_FILTERED_INACTIVE, gridIndices );
if ( !faultCollection()->isShowingFaultsAndFaultsOutsideFilters() )
if ( faultCollection()->shouldApplyCellFiltersToFaults() )
{
m_reservoirGridPartManager->appendFaultsStaticGeometryPartsToModel( frameParts.p(), RANGE_FILTERED_INACTIVE );
}
@@ -819,7 +818,7 @@ void RimEclipseView::updateVisibleGeometries()
{
m_reservoirGridPartManager->appendStaticGeometryPartsToModel( frameParts.p(), INACTIVE, gridIndices );
if ( !faultCollection()->isShowingFaultsAndFaultsOutsideFilters() )
if ( faultCollection()->shouldApplyCellFiltersToFaults() )
{
m_reservoirGridPartManager->appendFaultsStaticGeometryPartsToModel( frameParts.p(), INACTIVE );
}
@@ -1934,7 +1933,7 @@ std::set<RivCellSetEnum> RimEclipseView::allVisibleFaultGeometryTypes() const
std::set<RivCellSetEnum> faultGeoTypes;
faultGeoTypes.insert( m_visibleGridParts.begin(), m_visibleGridParts.end() );
if ( faultCollection()->isShowingFaultsAndFaultsOutsideFilters() )
if ( !faultCollection()->shouldApplyCellFiltersToFaults() )
{
faultGeoTypes.insert( ACTIVE );
faultGeoTypes.insert( ALL_WELL_CELLS );
@@ -2208,6 +2207,37 @@ void RimEclipseView::calculateCurrentTotalCellVisibility( cvf::UByteArray* total
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseView::calculateCellVisibility( cvf::UByteArray* visibility, std::vector<RivCellSetEnum> geomTypes, int timeStep )
{
size_t cellCount = this->mainGrid()->globalCellArray().size();
visibility->resize( cellCount );
visibility->setAll( false );
std::vector<size_t> gridIndices = this->indicesToVisibleGrids();
const auto gridCount = this->eclipseCase()->eclipseCaseData()->gridCount();
for ( size_t gridIdx = 0; gridIdx < gridCount; gridIdx++ )
{
RigGridBase* grid = this->eclipseCase()->eclipseCaseData()->grid( gridIdx );
int gridCellCount = static_cast<int>( grid->cellCount() );
for ( auto vizType : geomTypes )
{
const cvf::UByteArray* gridVisibility = m_reservoirGridPartManager->cellVisibility( vizType, gridIdx, timeStep );
for ( int lcIdx = 0; lcIdx < gridCellCount; ++lcIdx )
{
( *visibility )[grid->reservoirCellIndex( lcIdx )] |= ( *gridVisibility )[lcIdx];
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -155,6 +155,8 @@ public:
void calculateCurrentTotalCellVisibility( cvf::UByteArray* totalVisibility, int timeStep ) override;
void calculateCellVisibility( cvf::UByteArray* visibility, std::vector<RivCellSetEnum> geomTypes, int timeStep = 0 ) override;
std::vector<RimLegendConfig*> legendConfigs() const override;
cvf::Color4f colorFromCellCategory( RivCellSetEnum geometryType ) const;
@@ -46,6 +46,7 @@
#include "Riu3DMainWindowTools.h"
#include "Riu3dSelectionManager.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "RivSingleCellPartGenerator.h"
@@ -112,6 +113,9 @@ RimGridView::RimGridView()
m_surfaceVizModel = new cvf::ModelBasicList;
m_surfaceVizModel->setName( "SurfaceModel" );
m_intersectionVizModel = new cvf::ModelBasicList;
m_intersectionVizModel->setName( "CrossSectionModel" );
}
//--------------------------------------------------------------------------------------------------
@@ -493,3 +497,63 @@ void RimGridView::updateSurfacesInViewTreeItems()
this->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridView::appendIntersectionsForCurrentTimeStep()
{
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 );
cvf::UByteArray visibility;
calculateCellVisibility( &visibility, { PROPERTY_FILTERED, PROPERTY_FILTERED_WELL_CELLS }, m_currentTimeStep );
m_intersectionCollection->appendDynamicPartsToModel( frameParts.p(), scaleTransform(), m_currentTimeStep, &visibility );
frameParts->updateBoundingBoxesRecursive();
frameScene->addModel( frameParts.p() );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridView::appendIntersectionsToModel( bool cellFiltersActive, bool propertyFiltersActive )
{
m_intersectionVizModel->removeAllParts();
if ( m_intersectionCollection->isActive() )
{
m_intersectionCollection->clearGeometry();
if ( m_intersectionCollection->shouldApplyCellFiltersToIntersections() && ( cellFiltersActive || propertyFiltersActive ) )
{
m_intersectionCollection->appendPartsToModel( *this, m_intersectionVizModel.p(), scaleTransform() );
if ( !propertyFiltersActive )
{
cvf::UByteArray visibleCells;
calculateCellVisibility( &visibleCells, { RANGE_FILTERED_WELL_CELLS, RANGE_FILTERED } );
m_intersectionCollection->appendDynamicPartsToModel( m_intersectionVizModel.p(), scaleTransform(), currentTimeStep(), &visibleCells );
}
}
else
{
m_intersectionCollection->appendPartsToModel( *this, m_intersectionVizModel.p(), scaleTransform() );
m_intersectionCollection->appendDynamicPartsToModel( m_intersectionVizModel.p(), scaleTransform(), currentTimeStep() );
}
m_intersectionVizModel->updateBoundingBoxesRecursive();
nativeOrOverrideViewer()->addStaticModelOnce( m_intersectionVizModel.p(), isUsingOverrideViewer() );
}
}
@@ -84,8 +84,14 @@ protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void initAfterRead() override;
void appendIntersectionsForCurrentTimeStep();
void appendIntersectionsToModel( bool cellFiltersActive, bool propertyFiltersActive );
virtual void calculateCellVisibility( cvf::UByteArray* visibility, std::vector<RivCellSetEnum> geomTypes, int timeStep = 0 ) = 0;
protected:
cvf::ref<cvf::ModelBasicList> m_surfaceVizModel;
cvf::ref<cvf::ModelBasicList> m_intersectionVizModel;
// Fields
caf::PdmChildField<RimIntersectionCollection*> m_intersectionCollection;