mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix display of intersection lines in 3D view
* 10675 Fix missing intersection line geometry * Change to list of visible surface intersection lines * Enable surface intersection band for any intersection * Show labels for intersection curves in 3D The polylines are defined in the display coordinate system without Z-scaling. The z-scaling is applied to the visualization parts using Part::setTransform(Transform* transform) The annotation objects are defined by display coordinates, so apply the Z-scaling to the coordinates. * Improve naming of surfaces * Use scaling factor of 1.0 for flat intersection views
This commit is contained in:
@@ -248,7 +248,7 @@ void RimIntersectionCollection::appendDynamicPartsToModel( cvf::ModelBasicList*
|
||||
{
|
||||
if ( cs->isActive() )
|
||||
{
|
||||
cs->intersectionPartMgr()->generatePartGeometry( visibleCells );
|
||||
cs->intersectionPartMgr()->generatePartGeometry( visibleCells, scaleTransform );
|
||||
cs->intersectionPartMgr()->appendIntersectionFacesToModel( model, scaleTransform );
|
||||
cs->intersectionPartMgr()->appendMeshLinePartsToModel( model, scaleTransform );
|
||||
}
|
||||
|
||||
@@ -539,7 +539,7 @@ void Rim2dIntersectionView::onCreateDisplayModel()
|
||||
|
||||
m_intersectionVizModel->removeAllParts();
|
||||
|
||||
m_flatIntersectionPartMgr->generatePartGeometry( nullptr );
|
||||
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() );
|
||||
|
||||
@@ -1698,7 +1698,9 @@ void Rim3dView::updateScreenSpaceModel()
|
||||
annoTool.setCountHint( m_annotationCountHint() );
|
||||
}
|
||||
|
||||
annoTool.addAnnotationLabels( partCollection, m_viewer->mainCamera(), m_screenSpaceModel.p() );
|
||||
// The scaling factor is computed using the camera, and this does not work for the flat intersection view
|
||||
bool computeScalingFactor = ( viewContent() != RiaDefines::View3dContent::FLAT_INTERSECTION );
|
||||
annoTool.addAnnotationLabels( partCollection, m_viewer->mainCamera(), m_screenSpaceModel.p(), computeScalingFactor );
|
||||
|
||||
nativeOrOverrideViewer()->addStaticModelOnce( m_screenSpaceModel.p(), isUsingOverrideViewer() );
|
||||
}
|
||||
|
||||
@@ -528,19 +528,24 @@ void RimGridView::appendIntersectionsToModel( bool cellFiltersActive, bool prope
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
// NB! Geometry objects are recreated in appendDynamicPartsToModel(), always call
|
||||
// appendPartsToModel() after appendDynamicPartsToModel()
|
||||
m_intersectionCollection->appendPartsToModel( *this, m_intersectionVizModel.p(), scaleTransform() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_intersectionCollection->appendPartsToModel( *this, m_intersectionVizModel.p(), scaleTransform() );
|
||||
m_intersectionCollection->appendDynamicPartsToModel( m_intersectionVizModel.p(), scaleTransform(), currentTimeStep() );
|
||||
|
||||
// NB! Geometry objects are recreated in appendDynamicPartsToModel(), always call
|
||||
// appendPartsToModel() after appendDynamicPartsToModel()
|
||||
m_intersectionCollection->appendPartsToModel( *this, m_intersectionVizModel.p(), scaleTransform() );
|
||||
}
|
||||
m_intersectionVizModel->updateBoundingBoxesRecursive();
|
||||
nativeOrOverrideViewer()->addStaticModelOnce( m_intersectionVizModel.p(), isUsingOverrideViewer() );
|
||||
|
||||
@@ -55,8 +55,8 @@ RimSeismicSectionCollection::RimSeismicSectionCollection()
|
||||
|
||||
CAF_PDM_InitField( &m_surfaceIntersectionLinesScaleFactor, "SurfaceIntersectionLinesScaleFactor", 5.0, "Line Scale Factor ( >= 1.0 )" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_hiddenSurfaceLines, "HiddenSurfaceLines", "Hidden Surface Lines" );
|
||||
m_hiddenSurfaceLines.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
|
||||
CAF_PDM_InitFieldNoDefault( &m_surfacesWithVisibleSurfaceLines, "SurfacesWithVisibleSurfaceLines", "Surface Lines" );
|
||||
m_surfacesWithVisibleSurfaceLines.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
|
||||
|
||||
setName( "Seismic Sections" );
|
||||
}
|
||||
@@ -148,7 +148,7 @@ void RimSeismicSectionCollection::defineUiOrdering( QString uiConfigName, caf::P
|
||||
{
|
||||
auto grp = uiOrdering.addNewGroup( "Surface Intersection Lines" );
|
||||
grp->add( &m_surfaceIntersectionLinesScaleFactor );
|
||||
grp->add( &m_hiddenSurfaceLines );
|
||||
grp->add( &m_surfacesWithVisibleSurfaceLines );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
@@ -171,23 +171,7 @@ void RimSeismicSectionCollection::appendPartsToModel( Rim3dView*
|
||||
{
|
||||
if ( !isChecked() ) return;
|
||||
|
||||
auto computeVisibleSurface = [&]() -> std::vector<RimSurface*>
|
||||
{
|
||||
std::vector<RimSurface*> visibleSurfaces;
|
||||
auto allSurfaces = RimTools::surfaceCollection()->surfaces();
|
||||
auto hiddenSurfaces = m_hiddenSurfaceLines.value();
|
||||
|
||||
for ( const auto& surf : allSurfaces )
|
||||
{
|
||||
if ( std::find( hiddenSurfaces.begin(), hiddenSurfaces.end(), surf ) != hiddenSurfaces.end() ) continue;
|
||||
|
||||
visibleSurfaces.push_back( surf );
|
||||
}
|
||||
|
||||
return visibleSurfaces;
|
||||
};
|
||||
|
||||
auto visibleSurfaces = computeVisibleSurface();
|
||||
auto visibleSurfaces = m_surfacesWithVisibleSurfaceLines().ptrReferencedObjectsByType();
|
||||
|
||||
for ( auto& section : m_seismicSections )
|
||||
{
|
||||
@@ -275,6 +259,21 @@ void RimSeismicSectionCollection::updateLegendRangesTextAndVisibility( RiuViewer
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSeismicSectionCollection::setSurfacesVisible( const std::vector<RimSurface*>& surfaces )
|
||||
{
|
||||
for ( auto surface : surfaces )
|
||||
{
|
||||
if ( std::find( m_surfacesWithVisibleSurfaceLines.begin(), m_surfacesWithVisibleSurfaceLines.end(), surface ) ==
|
||||
m_surfacesWithVisibleSurfaceLines.end() )
|
||||
{
|
||||
m_surfacesWithVisibleSurfaceLines.push_back( surface );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -282,8 +281,11 @@ QList<caf::PdmOptionItemInfo> RimSeismicSectionCollection::calculateValueOptions
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_hiddenSurfaceLines )
|
||||
if ( fieldNeedingOptions == &m_surfacesWithVisibleSurfaceLines )
|
||||
{
|
||||
// If a surface is deleted, we need to remove it from the list of surfaces with visible surface lines
|
||||
m_surfacesWithVisibleSurfaceLines.removePtr( nullptr );
|
||||
|
||||
auto surfaceCollection = RimTools::surfaceCollection();
|
||||
for ( auto surface : surfaceCollection->surfaces() )
|
||||
{
|
||||
|
||||
@@ -72,6 +72,8 @@ public:
|
||||
std::vector<RimRegularLegendConfig*> legendConfigs();
|
||||
void updateLegendRangesTextAndVisibility( RiuViewer* nativeOrOverrideViewer, bool isUsingOverrideViewer );
|
||||
|
||||
void setSurfacesVisible( const std::vector<RimSurface*>& surfaces );
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
@@ -88,5 +90,5 @@ private:
|
||||
caf::PdmChildArrayField<RimSeismicSection*> m_seismicSections;
|
||||
|
||||
caf::PdmField<double> m_surfaceIntersectionLinesScaleFactor;
|
||||
caf::PdmPtrArrayField<RimSurface*> m_hiddenSurfaceLines;
|
||||
caf::PdmPtrArrayField<RimSurface*> m_surfacesWithVisibleSurfaceLines;
|
||||
};
|
||||
|
||||
@@ -594,7 +594,8 @@ bool RimGridCaseSurface::exportStructSurfaceFromGridCase( std::vector<cvf::Vec3d
|
||||
QString RimGridCaseSurface::fullName() const
|
||||
{
|
||||
QString retval = RimSurface::fullName();
|
||||
retval += " - K:";
|
||||
if ( !retval.isEmpty() ) retval += " - ";
|
||||
retval += "K:";
|
||||
retval += QString::number( m_oneBasedSliceIndex );
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -234,7 +234,11 @@ QString RimSurface::fullName() const
|
||||
{
|
||||
if ( depthOffset() != 0.0 )
|
||||
{
|
||||
return QString( "%1 - Offset:%2" ).arg( m_userDescription, QString::number( depthOffset() ) );
|
||||
QString name = m_userDescription;
|
||||
if ( !name.isEmpty() ) name += " - ";
|
||||
name += QString( "Offset:%1" ).arg( QString::number( depthOffset() ) );
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
return QString( "%1" ).arg( m_userDescription );
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSeismicSectionCollection.h"
|
||||
#include "RimSurface.h"
|
||||
#include "RimSurfaceInView.h"
|
||||
#include "RimSurfaceResultDefinition.h"
|
||||
@@ -241,7 +242,6 @@ RimSurface* RimSurfaceCollection::addGridCaseSurface( RimCase* sourceCase, int o
|
||||
s->setCase( sourceCase );
|
||||
|
||||
s->setOneBasedIndex( oneBasedSliceIndex );
|
||||
s->setUserDescription( "Surface" );
|
||||
|
||||
if ( !s->onLoadData() )
|
||||
{
|
||||
@@ -305,6 +305,12 @@ void RimSurfaceCollection::updateViews( const std::vector<RimSurface*>& surfsToR
|
||||
for ( auto view : views )
|
||||
{
|
||||
view->updateSurfacesInViewTreeItems();
|
||||
|
||||
if ( auto gridView = dynamic_cast<RimGridView*>( view ) )
|
||||
{
|
||||
auto seismicCollection = gridView->seismicSectionCollection();
|
||||
seismicCollection->setSurfacesVisible( surfsToReload );
|
||||
}
|
||||
}
|
||||
|
||||
std::set<Rim3dView*> viewsNeedingUpdate;
|
||||
|
||||
Reference in New Issue
Block a user