mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5380 Surface : Modification of depth
This commit is contained in:
parent
c950f19a51
commit
699a3f9b34
@ -155,6 +155,7 @@ void RivSurfaceIntersectionGeometryGenerator::calculateArrays()
|
||||
const std::vector<cvf::Vec3d>& nativeVertices = m_usedSurfaceData->vertices();
|
||||
const std::vector<unsigned>& nativeTriangleIndices = m_usedSurfaceData->triangleIndices();
|
||||
cvf::Vec3d displayModelOffset = m_hexGrid->displayOffset();
|
||||
double depthOffset = m_surfaceInView->depthOffset();
|
||||
|
||||
m_triVxToCellCornerWeights.reserve( nativeTriangleIndices.size() * 24 );
|
||||
outputTriangleVertices.reserve( nativeTriangleIndices.size() * 24 );
|
||||
@ -187,6 +188,10 @@ void RivSurfaceIntersectionGeometryGenerator::calculateArrays()
|
||||
cvf::Vec3d p1 = nativeVertices[nativeTriangleIndices[ntVxIdx + 1]];
|
||||
cvf::Vec3d p2 = nativeVertices[nativeTriangleIndices[ntVxIdx + 2]];
|
||||
|
||||
p0.z() = p0.z() - depthOffset;
|
||||
p1.z() = p1.z() - depthOffset;
|
||||
p2.z() = p2.z() - depthOffset;
|
||||
|
||||
cvf::BoundingBox triangleBBox;
|
||||
triangleBBox.add( p0 );
|
||||
triangleBBox.add( p1 );
|
||||
|
@ -377,7 +377,9 @@ void RivSurfacePartMgr::generateNativePartGeometry()
|
||||
m_surfaceInView->firstAncestorOrThisOfTypeAsserted( ownerCase );
|
||||
cvf::Vec3d displayModOffsett = ownerCase->displayModelOffset();
|
||||
|
||||
m_usedSurfaceData = m_surfaceInView->surface()->surfaceData();
|
||||
m_usedSurfaceData = m_surfaceInView->surface()->surfaceData();
|
||||
double depthOffset = m_surfaceInView->depthOffset();
|
||||
displayModOffsett.z() = displayModOffsett.z() + depthOffset;
|
||||
|
||||
const std::vector<cvf::Vec3d>& vertices = m_usedSurfaceData->vertices();
|
||||
cvf::ref<cvf::Vec3fArray> cvfVertices = new cvf::Vec3fArray( vertices.size() );
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "RivHexGridIntersectionTools.h"
|
||||
#include "RivSurfacePartMgr.h"
|
||||
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimSurfaceInView, "SurfaceInView" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -42,6 +44,9 @@ RimSurfaceInView::RimSurfaceInView()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_surface, "SurfaceRef", "Surface", "", "", "" );
|
||||
m_surface.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_depthOffset, "DepthOffset", 0.0, "Depth Offset", "", "", "" );
|
||||
m_depthOffset.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -77,6 +82,14 @@ void RimSurfaceInView::setSurface( RimSurface* surf )
|
||||
m_surface = surf;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimSurfaceInView::depthOffset() const
|
||||
{
|
||||
return m_depthOffset;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -102,15 +115,25 @@ void RimSurfaceInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
bool scheduleRedraw = false;
|
||||
|
||||
if ( changedField == &m_isActive || changedField == &m_useSeparateDataSource || changedField == &m_separateDataSource )
|
||||
{
|
||||
RimGridView* ownerView;
|
||||
this->firstAncestorOrThisOfTypeAsserted( ownerView );
|
||||
ownerView->scheduleCreateDisplayModelAndRedraw();
|
||||
scheduleRedraw = true;
|
||||
}
|
||||
else if ( changedField == &m_showInactiveCells )
|
||||
{
|
||||
m_surfacePartMgr = nullptr;
|
||||
clearGeometry();
|
||||
scheduleRedraw = true;
|
||||
}
|
||||
else if ( changedField == &m_depthOffset )
|
||||
{
|
||||
clearGeometry();
|
||||
scheduleRedraw = true;
|
||||
}
|
||||
|
||||
if ( scheduleRedraw )
|
||||
{
|
||||
RimGridView* ownerView;
|
||||
this->firstAncestorOrThisOfTypeAsserted( ownerView );
|
||||
ownerView->scheduleCreateDisplayModelAndRedraw();
|
||||
@ -123,13 +146,29 @@ void RimSurfaceInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
||||
void RimSurfaceInView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_name );
|
||||
|
||||
uiOrdering.add( &m_showInactiveCells );
|
||||
uiOrdering.add( &m_depthOffset );
|
||||
|
||||
this->defineSeparateDataSourceUi( uiConfigName, uiOrdering );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSurfaceInView::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
auto doubleSliderAttrib = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute );
|
||||
if ( doubleSliderAttrib )
|
||||
{
|
||||
if ( field == &m_depthOffset )
|
||||
{
|
||||
doubleSliderAttrib->m_minimum = -2000;
|
||||
doubleSliderAttrib->m_maximum = 2000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -43,9 +43,16 @@ public:
|
||||
RimSurface* surface() const;
|
||||
void setSurface( RimSurface* surf );
|
||||
|
||||
double depthOffset() const;
|
||||
|
||||
void clearGeometry();
|
||||
RivSurfacePartMgr* surfacePartMgr();
|
||||
|
||||
protected:
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
private:
|
||||
virtual RimIntersectionResultsDefinitionCollection* findSeparateResultsCollection() override;
|
||||
|
||||
@ -56,5 +63,7 @@ private:
|
||||
caf::PdmProxyValueField<QString> m_name;
|
||||
caf::PdmPtrField<RimSurface*> m_surface;
|
||||
|
||||
caf::PdmField<double> m_depthOffset;
|
||||
|
||||
cvf::ref<RivSurfacePartMgr> m_surfacePartMgr;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user