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:
@@ -155,6 +155,7 @@ void RivSurfaceIntersectionGeometryGenerator::calculateArrays()
|
|||||||
const std::vector<cvf::Vec3d>& nativeVertices = m_usedSurfaceData->vertices();
|
const std::vector<cvf::Vec3d>& nativeVertices = m_usedSurfaceData->vertices();
|
||||||
const std::vector<unsigned>& nativeTriangleIndices = m_usedSurfaceData->triangleIndices();
|
const std::vector<unsigned>& nativeTriangleIndices = m_usedSurfaceData->triangleIndices();
|
||||||
cvf::Vec3d displayModelOffset = m_hexGrid->displayOffset();
|
cvf::Vec3d displayModelOffset = m_hexGrid->displayOffset();
|
||||||
|
double depthOffset = m_surfaceInView->depthOffset();
|
||||||
|
|
||||||
m_triVxToCellCornerWeights.reserve( nativeTriangleIndices.size() * 24 );
|
m_triVxToCellCornerWeights.reserve( nativeTriangleIndices.size() * 24 );
|
||||||
outputTriangleVertices.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 p1 = nativeVertices[nativeTriangleIndices[ntVxIdx + 1]];
|
||||||
cvf::Vec3d p2 = nativeVertices[nativeTriangleIndices[ntVxIdx + 2]];
|
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;
|
cvf::BoundingBox triangleBBox;
|
||||||
triangleBBox.add( p0 );
|
triangleBBox.add( p0 );
|
||||||
triangleBBox.add( p1 );
|
triangleBBox.add( p1 );
|
||||||
|
|||||||
@@ -377,7 +377,9 @@ void RivSurfacePartMgr::generateNativePartGeometry()
|
|||||||
m_surfaceInView->firstAncestorOrThisOfTypeAsserted( ownerCase );
|
m_surfaceInView->firstAncestorOrThisOfTypeAsserted( ownerCase );
|
||||||
cvf::Vec3d displayModOffsett = ownerCase->displayModelOffset();
|
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();
|
const std::vector<cvf::Vec3d>& vertices = m_usedSurfaceData->vertices();
|
||||||
cvf::ref<cvf::Vec3fArray> cvfVertices = new cvf::Vec3fArray( vertices.size() );
|
cvf::ref<cvf::Vec3fArray> cvfVertices = new cvf::Vec3fArray( vertices.size() );
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
#include "RivHexGridIntersectionTools.h"
|
#include "RivHexGridIntersectionTools.h"
|
||||||
#include "RivSurfacePartMgr.h"
|
#include "RivSurfacePartMgr.h"
|
||||||
|
|
||||||
|
#include "cafPdmUiDoubleSliderEditor.h"
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT( RimSurfaceInView, "SurfaceInView" );
|
CAF_PDM_SOURCE_INIT( RimSurfaceInView, "SurfaceInView" );
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -42,6 +44,9 @@ RimSurfaceInView::RimSurfaceInView()
|
|||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_surface, "SurfaceRef", "Surface", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_surface, "SurfaceRef", "Surface", "", "", "" );
|
||||||
m_surface.uiCapability()->setUiHidden( true );
|
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;
|
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& oldValue,
|
||||||
const QVariant& newValue )
|
const QVariant& newValue )
|
||||||
{
|
{
|
||||||
|
bool scheduleRedraw = false;
|
||||||
|
|
||||||
if ( changedField == &m_isActive || changedField == &m_useSeparateDataSource || changedField == &m_separateDataSource )
|
if ( changedField == &m_isActive || changedField == &m_useSeparateDataSource || changedField == &m_separateDataSource )
|
||||||
{
|
{
|
||||||
RimGridView* ownerView;
|
scheduleRedraw = true;
|
||||||
this->firstAncestorOrThisOfTypeAsserted( ownerView );
|
|
||||||
ownerView->scheduleCreateDisplayModelAndRedraw();
|
|
||||||
}
|
}
|
||||||
else if ( changedField == &m_showInactiveCells )
|
else if ( changedField == &m_showInactiveCells )
|
||||||
{
|
{
|
||||||
m_surfacePartMgr = nullptr;
|
clearGeometry();
|
||||||
|
scheduleRedraw = true;
|
||||||
|
}
|
||||||
|
else if ( changedField == &m_depthOffset )
|
||||||
|
{
|
||||||
|
clearGeometry();
|
||||||
|
scheduleRedraw = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( scheduleRedraw )
|
||||||
|
{
|
||||||
RimGridView* ownerView;
|
RimGridView* ownerView;
|
||||||
this->firstAncestorOrThisOfTypeAsserted( ownerView );
|
this->firstAncestorOrThisOfTypeAsserted( ownerView );
|
||||||
ownerView->scheduleCreateDisplayModelAndRedraw();
|
ownerView->scheduleCreateDisplayModelAndRedraw();
|
||||||
@@ -123,13 +146,29 @@ void RimSurfaceInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
|||||||
void RimSurfaceInView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
void RimSurfaceInView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||||
{
|
{
|
||||||
uiOrdering.add( &m_name );
|
uiOrdering.add( &m_name );
|
||||||
|
|
||||||
uiOrdering.add( &m_showInactiveCells );
|
uiOrdering.add( &m_showInactiveCells );
|
||||||
|
uiOrdering.add( &m_depthOffset );
|
||||||
|
|
||||||
this->defineSeparateDataSourceUi( uiConfigName, uiOrdering );
|
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;
|
RimSurface* surface() const;
|
||||||
void setSurface( RimSurface* surf );
|
void setSurface( RimSurface* surf );
|
||||||
|
|
||||||
|
double depthOffset() const;
|
||||||
|
|
||||||
void clearGeometry();
|
void clearGeometry();
|
||||||
RivSurfacePartMgr* surfacePartMgr();
|
RivSurfacePartMgr* surfacePartMgr();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||||
|
QString uiConfigName,
|
||||||
|
caf::PdmUiEditorAttribute* attribute ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual RimIntersectionResultsDefinitionCollection* findSeparateResultsCollection() override;
|
virtual RimIntersectionResultsDefinitionCollection* findSeparateResultsCollection() override;
|
||||||
|
|
||||||
@@ -56,5 +63,7 @@ private:
|
|||||||
caf::PdmProxyValueField<QString> m_name;
|
caf::PdmProxyValueField<QString> m_name;
|
||||||
caf::PdmPtrField<RimSurface*> m_surface;
|
caf::PdmPtrField<RimSurface*> m_surface;
|
||||||
|
|
||||||
|
caf::PdmField<double> m_depthOffset;
|
||||||
|
|
||||||
cvf::ref<RivSurfacePartMgr> m_surfacePartMgr;
|
cvf::ref<RivSurfacePartMgr> m_surfacePartMgr;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user