Skip to content

Commit

Permalink
Minor seismic surface lines fixes
Browse files Browse the repository at this point in the history
* Support continuous lines along the seismic surface
* Make sure watertight surface include all cells
* Remove unused function and mark with static
* Invert surface intersection line visibility control
  • Loading branch information
magnesj authored Sep 11, 2023
1 parent 7632064 commit f931021
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ std::vector<std::vector<cvf::Vec3d>>
{
domainCurvePoints.emplace_back( intersectionPoint );
}
else

// Create a line segment if we did not find an intersection point or if we are at the end of the polyline
if ( !foundMatch || ( point == resampledPolyline.back() ) )
{
if ( domainCurvePoints.size() > 1 )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ class RivSeismicSectionPartMgr : public RivTexturePartMgr
double lineThickness,
const std::vector<RimSurface*>& surfaces );

private:
cvf::ref<cvf::DrawableGeo> createXYPlaneQuadGeoWithTexCoords( const cvf::Vec3dArray& cornerPoints );

protected:
cvf::TextureImage* createImageFromData( ZGYAccess::SeismicSliceData* data );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class RivTexturePartMgr : public cvf::Object
const cvf::BoundingBox& boundingBox ) = 0;

protected:
cvf::ref<cvf::DrawableGeo> createXYPlaneQuadGeoWithTexCoords( const cvf::Vec3dArray& cornerPoints );
static cvf::ref<cvf::DrawableGeo> createXYPlaneQuadGeoWithTexCoords( const cvf::Vec3dArray& cornerPoints );
cvf::ref<cvf::Part> createSingleTexturedQuadPart( const cvf::Vec3dArray& cornerPoints, cvf::ref<cvf::TextureImage> image, bool transparent );

cvf::ref<cvf::ShaderProgram> m_textureShaderProg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ RimSeismicSectionCollection::RimSeismicSectionCollection()

CAF_PDM_InitField( &m_surfaceIntersectionLinesScaleFactor, "SurfaceIntersectionLinesScaleFactor", 5.0, "Line Scale Factor ( >= 1.0 )" );

CAF_PDM_InitFieldNoDefault( &m_visibleSurfaceLines, "VisibleSurfaceLines", "Visible Surface Lines" );
m_visibleSurfaceLines.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
CAF_PDM_InitFieldNoDefault( &m_hiddenSurfaceLines, "HiddenSurfaceLines", "Hidden Surface Lines" );
m_hiddenSurfaceLines.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );

setName( "Seismic Sections" );
}
Expand Down Expand Up @@ -147,7 +147,7 @@ caf::PdmFieldHandle* RimSeismicSectionCollection::userDescriptionField()
void RimSeismicSectionCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_surfaceIntersectionLinesScaleFactor );
uiOrdering.add( &m_visibleSurfaceLines );
uiOrdering.add( &m_hiddenSurfaceLines );

uiOrdering.skipRemainingFields( true );
}
Expand All @@ -170,6 +170,24 @@ 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();

for ( auto& section : m_seismicSections )
{
if ( section->isChecked() )
Expand All @@ -178,13 +196,7 @@ void RimSeismicSectionCollection::appendPartsToModel( Rim3dView*
{
section->partMgr()->appendGeometryPartsToModel( model, transform, boundingBox );

std::vector<RimSurface*> surfaces;
for ( const auto& surf : m_visibleSurfaceLines.value() )
{
surfaces.push_back( surf );
}

section->partMgr()->appendSurfaceIntersectionLines( model, transform, m_surfaceIntersectionLinesScaleFactor(), surfaces );
section->partMgr()->appendSurfaceIntersectionLines( model, transform, m_surfaceIntersectionLinesScaleFactor(), visibleSurfaces );
}
section->partMgr()->appendPolylinePartsToModel( view, model, transform, boundingBox );
}
Expand Down Expand Up @@ -269,7 +281,7 @@ QList<caf::PdmOptionItemInfo> RimSeismicSectionCollection::calculateValueOptions
{
QList<caf::PdmOptionItemInfo> options;

if ( fieldNeedingOptions == &m_visibleSurfaceLines )
if ( fieldNeedingOptions == &m_hiddenSurfaceLines )
{
auto surfaceCollection = RimTools::surfaceCollection();
for ( auto surface : surfaceCollection->surfaces() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ class RimSeismicSectionCollection : public RimCheckableNamedObject
caf::PdmChildArrayField<RimSeismicSection*> m_seismicSections;

caf::PdmField<double> m_surfaceIntersectionLinesScaleFactor;
caf::PdmPtrArrayField<RimSurface*> m_visibleSurfaceLines;
caf::PdmPtrArrayField<RimSurface*> m_hiddenSurfaceLines;
};
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ void RimGridCaseSurface::extractGridDataUsingFourVerticesPerCell()
const auto& cell = grid->cell( currentCellIndex );

if ( cell.isInvalid() ) continue;
if ( !m_includeInactiveCells() && activeCells && !activeCells->isActive( currentCellIndex ) ) continue;

bool skipInactiveCells = !m_includeInactiveCells();
if ( m_watertight ) skipInactiveCells = false;
if ( skipInactiveCells && activeCells && !activeCells->isActive( currentCellIndex ) ) continue;

cvf::Vec3d currentCornerVerts[8];

Expand Down

0 comments on commit f931021

Please sign in to comment.