mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5273 Allen Diagrams: Create special geometry for Allen NNC results
This commit is contained in:
@@ -72,13 +72,22 @@ RivFaultPartMgr::RivFaultPartMgr( const RigGridBase* grid,
|
||||
m_nativeFaultGenerator = new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), true );
|
||||
m_oppositeFaultGenerator = new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), false );
|
||||
|
||||
m_NNCGenerator = new RivNNCGeometryGenerator( grid->mainGrid()->nncData(),
|
||||
m_nativeFaultFacesTextureCoords = new cvf::Vec2fArray;
|
||||
m_oppositeFaultFacesTextureCoords = new cvf::Vec2fArray;
|
||||
|
||||
m_NNCGenerator = new RivNNCGeometryGenerator( false,
|
||||
grid->mainGrid()->nncData(),
|
||||
grid->mainGrid()->displayModelOffset(),
|
||||
connIdxes.p() );
|
||||
|
||||
m_nativeFaultFacesTextureCoords = new cvf::Vec2fArray;
|
||||
m_oppositeFaultFacesTextureCoords = new cvf::Vec2fArray;
|
||||
m_NNCTextureCoords = new cvf::Vec2fArray;
|
||||
m_NNCTextureCoords = new cvf::Vec2fArray;
|
||||
|
||||
m_allenNNCGenerator = new RivNNCGeometryGenerator( true,
|
||||
grid->mainGrid()->nncData(),
|
||||
grid->mainGrid()->displayModelOffset(),
|
||||
connIdxes.p() );
|
||||
|
||||
m_allenNNCTextureCoords = new cvf::Vec2fArray;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -89,6 +98,7 @@ void RivFaultPartMgr::setCellVisibility( cvf::UByteArray* cellVisibilities )
|
||||
m_nativeFaultGenerator->setCellVisibility( cellVisibilities );
|
||||
m_oppositeFaultGenerator->setCellVisibility( cellVisibilities );
|
||||
m_NNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() );
|
||||
m_allenNNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() );
|
||||
|
||||
generatePartGeometry();
|
||||
}
|
||||
@@ -397,6 +407,34 @@ void RivFaultPartMgr::generatePartGeometry()
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> geo = m_allenNNCGenerator->generateSurface();
|
||||
if ( geo.notNull() )
|
||||
{
|
||||
geo->computeNormals();
|
||||
|
||||
if ( useBufferObjects )
|
||||
{
|
||||
geo->setRenderMode( cvf::DrawableGeo::BUFFER_OBJECT );
|
||||
}
|
||||
|
||||
cvf::ref<cvf::Part> part = new cvf::Part;
|
||||
part->setName( "Allen NNC in Fault. Grid " + cvf::String( static_cast<int>( m_grid->gridIndex() ) ) );
|
||||
part->setDrawable( geo.p() );
|
||||
|
||||
// Set mapping from triangle face index to cell index
|
||||
cvf::ref<RivSourceInfo> si = new RivSourceInfo( m_rimFault, m_grid->gridIndex() );
|
||||
si->m_NNCIndices = m_allenNNCGenerator->triangleToNNCIndex().p();
|
||||
part->setSourceInfo( si.p() );
|
||||
|
||||
part->updateBoundingBox();
|
||||
part->setEnableMask( faultBit );
|
||||
part->setPriority( RivPartPriority::PartType::Nnc );
|
||||
|
||||
m_allenNNCFaces = part;
|
||||
}
|
||||
}
|
||||
|
||||
createLabelWithAnchorLine( m_nativeFaultFaces.p() );
|
||||
|
||||
updatePartEffect();
|
||||
@@ -449,7 +487,9 @@ void RivFaultPartMgr::updatePartEffect()
|
||||
m_nativeFaultFaces->setPriority( RivPartPriority::PartType::TransparentFault );
|
||||
if ( m_oppositeFaultFaces.notNull() )
|
||||
m_oppositeFaultFaces->setPriority( RivPartPriority::PartType::TransparentFault );
|
||||
|
||||
if ( m_NNCFaces.notNull() ) m_NNCFaces->setPriority( RivPartPriority::PartType::TransparentNnc );
|
||||
if ( m_allenNNCFaces.notNull() ) m_allenNNCFaces->setPriority( RivPartPriority::PartType::TransparentNnc );
|
||||
|
||||
if ( m_nativeFaultGridLines.notNull() )
|
||||
{
|
||||
@@ -643,7 +683,15 @@ void RivFaultPartMgr::appendMeshLinePartsToModel( cvf::ModelBasicList* model )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPartMgr::appendNNCFacesToModel( cvf::ModelBasicList* model )
|
||||
void RivFaultPartMgr::appendCompleteNNCFacesToModel( cvf::ModelBasicList* model )
|
||||
{
|
||||
if ( m_allenNNCFaces.notNull() ) model->addPart( m_allenNNCFaces.p() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivFaultPartMgr::appendNativeNNCFacesToModel( cvf::ModelBasicList* model )
|
||||
{
|
||||
if ( m_NNCFaces.notNull() ) model->addPart( m_NNCFaces.p() );
|
||||
}
|
||||
@@ -730,6 +778,12 @@ void RivFaultPartMgr::updateNNCColors( size_t timeStepIndex, RimEclipseCellColor
|
||||
resultType,
|
||||
eclResAddr,
|
||||
nativeTimeStepIndex );
|
||||
|
||||
m_allenNNCGenerator->textureCoordinates( m_allenNNCTextureCoords.p(),
|
||||
mapper,
|
||||
resultType,
|
||||
eclResAddr,
|
||||
nativeTimeStepIndex );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,10 +804,18 @@ void RivFaultPartMgr::updateNNCColors( size_t timeStepIndex, RimEclipseCellColor
|
||||
nncEffect = nncEffgen.generateCachedEffect();
|
||||
}
|
||||
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>( m_NNCFaces->drawable() );
|
||||
if ( dg ) dg->setTextureCoordArray( m_NNCTextureCoords.p() );
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>( m_NNCFaces->drawable() );
|
||||
if ( dg ) dg->setTextureCoordArray( m_NNCTextureCoords.p() );
|
||||
}
|
||||
|
||||
{
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>( m_allenNNCFaces->drawable() );
|
||||
if ( dg ) dg->setTextureCoordArray( m_allenNNCTextureCoords.p() );
|
||||
}
|
||||
|
||||
m_NNCFaces->setEffect( nncEffect.p() );
|
||||
m_allenNNCFaces->setEffect( nncEffect.p() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -780,5 +842,6 @@ void RivFaultPartMgr::updateNNCColors( size_t timeStepIndex, RimEclipseCellColor
|
||||
}
|
||||
|
||||
m_NNCFaces->setEffect( nncEffect.p() );
|
||||
m_allenNNCFaces->setEffect( nncEffect.p() );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user