Add seismic result info in 3D view (#10032)

Add seismic result info in 3D view and selection in tree
This commit is contained in:
jonjenssen 2023-03-29 14:08:45 +02:00 committed by GitHub
parent 090293c421
commit 1299af401b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 187 additions and 3 deletions

View File

@ -1,9 +1,11 @@
set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RivSeismicSectionPartMgr.h
${CMAKE_CURRENT_LIST_DIR}/RivSeismicSectionSourceInfo.h
)
set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RivSeismicSectionPartMgr.cpp
${CMAKE_CURRENT_LIST_DIR}/RivSeismicSectionSourceInfo.cpp
)
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@ -22,6 +22,7 @@
#include "RivPartPriority.h"
#include "RivPolylinePartMgr.h"
#include "RivSeismicSectionSourceInfo.h"
#include "Rim3dView.h"
#include "RimRegularLegendConfig.h"
@ -106,6 +107,10 @@ void RivSeismicSectionPartMgr::appendGeometryPartsToModel( cvf::ModelBasicList*
}
cvf::ref<cvf::Part> quadPart = createSingleTexturedQuadPart( displayPoints, part.texture );
cvf::ref<RivSeismicSectionSourceInfo> si = new RivSeismicSectionSourceInfo( m_section, i );
quadPart->setSourceInfo( si.p() );
model->addPart( quadPart.p() );
}
}

View File

@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivSeismicSectionSourceInfo.h"
#include "RimSeismicSection.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivSeismicSectionSourceInfo::RivSeismicSectionSourceInfo( RimSeismicSection* section, int partIndex )
: m_section( section )
, m_partIndex( partIndex )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSeismicSection* RivSeismicSectionSourceInfo::section() const
{
return m_section;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RivSeismicSectionSourceInfo::partIndex() const
{
return m_partIndex;
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmPointer.h"
#include "cvfObject.h"
class RimSeismicSection;
class RivSeismicSectionSourceInfo : public cvf::Object
{
public:
RivSeismicSectionSourceInfo( RimSeismicSection* section, int partIndex );
RimSeismicSection* section() const;
int partIndex() const;
private:
caf::PdmPointer<RimSeismicSection> m_section;
int m_partIndex;
};

View File

@ -511,6 +511,16 @@ cvf::Vec3d RimSeismicData::convertToWorldCoords( int iLine, int xLine, double de
return m_filereader->convertToWorldCoords( iLine, xLine, depth );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<int, int> RimSeismicData::convertToInlineXline( cvf::Vec3d worldCoords )
{
if ( !openFileIfNotOpen() ) return { 0, 0 };
return m_filereader->convertToInlineXline( worldCoords[0], worldCoords[1] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -681,3 +691,24 @@ std::shared_ptr<ZGYAccess::SeismicSliceData>
return retdata;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
float RimSeismicData::valueAt( cvf::Vec3d worldCoord )
{
if ( openFileIfNotOpen() )
{
auto [iline, xline] = convertToInlineXline( worldCoord );
int iIndex = toInlineIndex( iline );
int xIndex = toXlineIndex( xline );
int zIndex = toZIndex( std::abs( worldCoord[2] ) );
auto slice = m_filereader->trace( iIndex, xIndex, zIndex, 1 );
if ( slice->size() == 1 ) return slice->values()[0];
}
return std::nanf( "" );
}

View File

@ -81,13 +81,16 @@ public:
std::vector<cvf::Vec3d> worldOutline() const;
cvf::Vec3d convertToWorldCoords( int iLine, int xLine, double depth );
cvf::Vec3d convertToWorldCoords( int iLine, int xLine, double depth );
std::pair<int, int> convertToInlineXline( cvf::Vec3d worldCoords );
std::shared_ptr<ZGYAccess::SeismicSliceData>
sliceData( RiaDefines::SeismicSliceDirection direction, int sliceNumber, double zMin, double zMax );
std::shared_ptr<ZGYAccess::SeismicSliceData>
sliceData( double worldX1, double worldY1, double worldX2, double worldY2, double zMin, double zMax );
float valueAt( cvf::Vec3d worldCoord );
std::pair<double, double> dataRangeMinMax() const;
RimRegularLegendConfig* legendConfig() const;

View File

@ -54,6 +54,7 @@
#include <QPixmap>
#include <algorithm>
#include <cmath>
CAF_PDM_SOURCE_INIT( RimSeismicSection, "SeismicSection" );
@ -898,3 +899,32 @@ int RimSeismicSection::lowerFilterZ( int lowerGridLimit ) const
return lowerGridLimit;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimSeismicSection::resultInfoText( cvf::Vec3d worldCoord, int partIndex )
{
if ( ( seismicData() == nullptr ) || ( m_texturedSection.isNull() ) || ( partIndex >= m_texturedSection->partsCount() ) )
{
return "";
}
auto [iline, xline] = m_seismicData->convertToInlineXline( worldCoord );
QString retVal = QString( "Inline: %1\nCrossline: %2\nDepth: %3\n\n" ).arg( iline ).arg( xline ).arg( std::abs( (int)worldCoord[2] ) );
if ( m_texturedSection->partsCount() > 1 )
{
retVal += QString( "Section part: %1\n\n" ).arg( partIndex + 1 );
}
float val = m_seismicData->valueAt( worldCoord );
if ( !std::isnan( val ) )
{
retVal += QString( "Value: %1\n\n" ).arg( val );
}
return retVal;
}

View File

@ -89,6 +89,8 @@ public:
int lowerFilterZ( int lowerGridLimit ) const;
RimIntersectionFilterEnum zFilterType() const;
QString resultInfoText( cvf::Vec3d worldCoord, int partIndex );
protected:
void initAfterRead() override;
caf::PdmFieldHandle* userDescriptionField() override;

View File

@ -60,6 +60,7 @@
#include "RimLegendConfig.h"
#include "RimPerforationInterval.h"
#include "RimProject.h"
#include "RimSeismicSection.h"
#include "RimSimWellInView.h"
#include "RimStimPlanFractureTemplate.h"
#include "RimSurfaceInView.h"
@ -82,6 +83,7 @@
#include "RivObjectSourceInfo.h"
#include "RivPartPriority.h"
#include "RivReservoirSurfaceIntersectionSourceInfo.h"
#include "RivSeismicSectionSourceInfo.h"
#include "RivSimWellConnectionSourceInfo.h"
#include "RivSimWellPipeSourceInfo.h"
#include "RivSourceInfo.h"
@ -713,9 +715,10 @@ void RiuViewerCommands::handlePickAction( int winPosX, int winPosY, Qt::Keyboard
if ( firstHitPart && firstHitPart->sourceInfo() )
{
// clang-format off
const RivObjectSourceInfo* rivObjectSourceInfo = dynamic_cast<const RivObjectSourceInfo*>( firstHitPart->sourceInfo() );
const RivObjectSourceInfo* rivObjectSourceInfo = dynamic_cast<const RivObjectSourceInfo*>( firstHitPart->sourceInfo() );
const RivSimWellPipeSourceInfo* eclipseWellSourceInfo = dynamic_cast<const RivSimWellPipeSourceInfo*>( firstHitPart->sourceInfo() );
const RivWellConnectionSourceInfo* wellConnectionSourceInfo = dynamic_cast<const RivWellConnectionSourceInfo*>( firstHitPart->sourceInfo() );
const RivSeismicSectionSourceInfo* seismicSourceInfo = dynamic_cast<const RivSeismicSectionSourceInfo*>(firstHitPart->sourceInfo());
// clang-format on
if ( rivObjectSourceInfo )
@ -949,6 +952,30 @@ void RiuViewerCommands::handlePickAction( int winPosX, int winPosY, Qt::Keyboard
}
RiuMainWindow::instance()->selectAsCurrentItem( simWellConnectionSourceInfo->simWellInView(), allowActiveViewChange );
}
else if ( seismicSourceInfo != nullptr )
{
auto section = seismicSourceInfo->section();
RiuMainWindow::instance()->selectAsCurrentItem( section );
cvf::ref<caf::DisplayCoordTransform> transForm = mainOrComparisonView->displayCoordTransform();
cvf::Vec3d domainCoord = transForm->transformToDomainCoord( globalIntersectionPoint );
// Set surface resultInfo text
QString resultInfoText = "Seismic Section: \"" + section->userDescription() + "\"\n\n";
resultInfoText += section->resultInfoText( domainCoord, seismicSourceInfo->partIndex() );
// Set intersection point result text
QString pointText = QString( "Global point : [E: %1, N: %2, Depth: %3]" )
.arg( domainCoord.x(), 5, 'f', 2 )
.arg( domainCoord.y(), 5, 'f', 2 )
.arg( -domainCoord.z(), 5, 'f', 2 );
resultInfoText.append( pointText );
// Display result info text
RiuMainWindow::instance()->setResultInfo( resultInfoText );
}
}
}
}

2
ThirdParty/openzgy vendored

@ -1 +1 @@
Subproject commit 96293750197311582250ac387a1f7db29df290a1
Subproject commit 9c61a2b55d8c1d086233fb998eb335b9e9db1de5