#5380 Surface : Modification of depth

This commit is contained in:
Magne Sjaastad
2020-02-20 11:37:42 +01:00
parent c950f19a51
commit 699a3f9b34
4 changed files with 61 additions and 6 deletions

View File

@@ -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;
}
}
}
//--------------------------------------------------------------------------------------------------
///