mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Surface: click on surface in 3d view to display value (#7702)
* Support showing result info for surfaces when clicking on them in the 3d view
This commit is contained in:
parent
242e23a7c9
commit
2e08f278ca
@ -226,6 +226,44 @@ void RivSurfacePartMgr::updateNativeSurfaceColors()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RivSurfacePartMgr::resultInfoText( Rim3dView* view, uint hitPart, cvf::Vec3d hitPoint )
|
||||||
|
{
|
||||||
|
QString retval;
|
||||||
|
|
||||||
|
if ( m_surfaceInView->surfaceResultDefinition()->isChecked() )
|
||||||
|
{
|
||||||
|
const auto& values =
|
||||||
|
m_usedSurfaceData->propertyValues( m_surfaceInView->surfaceResultDefinition()->propertyName() );
|
||||||
|
const auto& ind = m_usedSurfaceData->triangleIndices();
|
||||||
|
const auto& vert = m_usedSurfaceData->vertices();
|
||||||
|
|
||||||
|
size_t indIndex = ( size_t )( hitPart * 3 );
|
||||||
|
|
||||||
|
// find closest triangle corner point to hit point and show that value
|
||||||
|
if ( ind.size() > ( indIndex + 2 ) )
|
||||||
|
{
|
||||||
|
uint vertIndex1 = ind[indIndex];
|
||||||
|
uint vertIndex2 = ind[indIndex + 1];
|
||||||
|
uint vertIndex3 = ind[indIndex + 2];
|
||||||
|
|
||||||
|
double dist1 = vert[vertIndex1].pointDistance( hitPoint );
|
||||||
|
double dist2 = vert[vertIndex2].pointDistance( hitPoint );
|
||||||
|
double dist3 = vert[vertIndex3].pointDistance( hitPoint );
|
||||||
|
|
||||||
|
double resultValue = values[vertIndex1];
|
||||||
|
if ( dist2 < dist1 ) resultValue = values[vertIndex2];
|
||||||
|
if ( ( dist3 < dist1 ) && ( dist3 < dist2 ) ) resultValue = values[vertIndex3];
|
||||||
|
|
||||||
|
retval +=
|
||||||
|
QString( "%1 : %2\n\n" ).arg( m_surfaceInView->surfaceResultDefinition()->propertyName() ).arg( resultValue );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -33,6 +33,7 @@ class DrawableGeo;
|
|||||||
class RimSurfaceInView;
|
class RimSurfaceInView;
|
||||||
class RigSurface;
|
class RigSurface;
|
||||||
class RigResultAccessor;
|
class RigResultAccessor;
|
||||||
|
class Rim3dView;
|
||||||
|
|
||||||
class RivSurfaceIntersectionGeometryGenerator;
|
class RivSurfaceIntersectionGeometryGenerator;
|
||||||
|
|
||||||
@ -47,6 +48,8 @@ public:
|
|||||||
|
|
||||||
void appendNativeGeometryPartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform );
|
void appendNativeGeometryPartsToModel( cvf::ModelBasicList* model, cvf::Transform* scaleTransform );
|
||||||
|
|
||||||
|
QString resultInfoText( Rim3dView* view, uint hitPart, cvf::Vec3d hitPoint );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void generatePartGeometry();
|
void generatePartGeometry();
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
#include "RivSimWellConnectionSourceInfo.h"
|
#include "RivSimWellConnectionSourceInfo.h"
|
||||||
#include "RivSimWellPipeSourceInfo.h"
|
#include "RivSimWellPipeSourceInfo.h"
|
||||||
#include "RivSourceInfo.h"
|
#include "RivSourceInfo.h"
|
||||||
|
#include "RivSurfacePartMgr.h"
|
||||||
#include "RivTernarySaturationOverlayItem.h"
|
#include "RivTernarySaturationOverlayItem.h"
|
||||||
#include "RivWellConnectionSourceInfo.h"
|
#include "RivWellConnectionSourceInfo.h"
|
||||||
#include "RivWellFracturePartMgr.h"
|
#include "RivWellFracturePartMgr.h"
|
||||||
@ -794,6 +795,24 @@ void RiuViewerCommands::handlePickAction( int winPosX, int winPosY, Qt::Keyboard
|
|||||||
if ( surf )
|
if ( surf )
|
||||||
{
|
{
|
||||||
RiuMainWindow::instance()->selectAsCurrentItem( surf, true );
|
RiuMainWindow::instance()->selectAsCurrentItem( surf, true );
|
||||||
|
cvf::ref<caf::DisplayCoordTransform> transForm = mainOrComparisonView->displayCoordTransform();
|
||||||
|
cvf::Vec3d domainCoord = transForm->transformToDomainCoord( globalIntersectionPoint );
|
||||||
|
|
||||||
|
// Set surface resultInfo text
|
||||||
|
QString resultInfoText = "Surface: " + surf->name() + "\n\n";
|
||||||
|
|
||||||
|
RivSurfacePartMgr* partMgr = surf->surfacePartMgr();
|
||||||
|
resultInfoText += partMgr->resultInfoText( mainOrComparisonView, firstPartTriangleIndex, domainCoord );
|
||||||
|
|
||||||
|
// Set intersection point result text
|
||||||
|
QString intersectionPointText = QString( "Intersection point : Global [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( intersectionPointText );
|
||||||
|
|
||||||
|
// Display result info text
|
||||||
|
RiuMainWindow::instance()->setResultInfo( resultInfoText );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( const RivReservoirSurfaceIntersectionSourceInfo* surfIntersectSourceInfo =
|
else if ( const RivReservoirSurfaceIntersectionSourceInfo* surfIntersectSourceInfo =
|
||||||
|
Loading…
Reference in New Issue
Block a user