mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improve visual appearance for depth surface
- disable intersection geometry with cell property colors - allow opacity - set default color to blue, as most user use this plane for oil-water contact
This commit is contained in:
@@ -81,6 +81,15 @@ RimSurface* RimDepthSurface::createCopy()
|
||||
return copyObject<RimDepthSurface>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimDepthSurface::showIntersectionCellResults()
|
||||
{
|
||||
// Avoid use of cell intersection results color for depth surfaces
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -141,6 +150,8 @@ void RimDepthSurface::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthSurface::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
RimSurface::defineEditorAttribute( field, uiConfigName, attribute );
|
||||
|
||||
caf::PdmUiDoubleValueEditorAttribute::testAndSetFixedWithTwoDecimals( attribute );
|
||||
|
||||
if ( field == &m_depth )
|
||||
@@ -199,6 +210,9 @@ void RimDepthSurface::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
auto group = uiOrdering.addNewGroup( "Appearance" );
|
||||
group->add( &m_userDescription );
|
||||
group->add( &m_color );
|
||||
|
||||
group->add( &m_enableOpacity );
|
||||
group->add( &m_opacity );
|
||||
}
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "RimSurface.h"
|
||||
|
||||
#include "cafPdmCoreVec3d.h"
|
||||
|
||||
class RimDepthSurface : public RimSurface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
@@ -31,6 +33,8 @@ public:
|
||||
bool onLoadData() override;
|
||||
RimSurface* createCopy() override;
|
||||
|
||||
bool showIntersectionCellResults() override;
|
||||
|
||||
void setPlaneExtent( double minX, double minY, double maxX, double maxY );
|
||||
void setDepth( double depth );
|
||||
void setDepthSliderLimits( double lower, double upper );
|
||||
|
||||
@@ -56,7 +56,11 @@ RimSurface::RimSurface()
|
||||
CAF_PDM_InitScriptableObject( "Surface", ":/ReservoirSurface16x16.png" );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_userDescription, "SurfaceUserDecription", "Name" );
|
||||
|
||||
CAF_PDM_InitField( &m_color, "SurfaceColor", cvf::Color3f( 0.5f, 0.3f, 0.2f ), "Color" );
|
||||
CAF_PDM_InitField( &m_enableOpacity, "EnableOpacity", false, "Enable Opacity" );
|
||||
CAF_PDM_InitField( &m_opacity, "Opacity", 0.6, "Opacity Value [0..1]" );
|
||||
m_opacity.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_depthOffset, "DepthOffset", 0.0, "Depth Offset" );
|
||||
m_depthOffset.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
@@ -94,6 +98,31 @@ cvf::Color3f RimSurface::color() const
|
||||
return m_color();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<bool, float> RimSurface::opacity() const
|
||||
{
|
||||
return std::make_pair( m_enableOpacity(), m_opacity() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSurface::setOpacity( bool useOpacity, float opacity )
|
||||
{
|
||||
m_enableOpacity.setValue( useOpacity );
|
||||
m_opacity.setValue( opacity );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSurface::showIntersectionCellResults()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -162,6 +191,9 @@ double RimSurface::depthOffset() const
|
||||
return m_depthOffset;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSurface::setDepthOffset( double depthoffset )
|
||||
{
|
||||
m_depthOffset.setValue( depthoffset );
|
||||
@@ -273,4 +305,13 @@ void RimSurface::defineEditorAttribute( const caf::PdmFieldHandle* field, QStrin
|
||||
doubleSliderAttrib->m_maximum = minimumExtent;
|
||||
}
|
||||
}
|
||||
|
||||
if ( field == &m_opacity )
|
||||
{
|
||||
if ( auto attr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute ) )
|
||||
{
|
||||
attr->m_minimum = 0.0;
|
||||
attr->m_maximum = 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,11 @@ public:
|
||||
void setColor( const cvf::Color3f& color );
|
||||
cvf::Color3f color() const;
|
||||
|
||||
std::pair<bool, float> opacity() const;
|
||||
void setOpacity( bool useOpacity, float opacity );
|
||||
|
||||
virtual bool showIntersectionCellResults();
|
||||
|
||||
RigSurface* surfaceData();
|
||||
QString userDescription();
|
||||
void setUserDescription( const QString& description );
|
||||
@@ -80,8 +85,11 @@ protected:
|
||||
virtual void clearCachedNativeData() = 0;
|
||||
|
||||
protected:
|
||||
caf::PdmField<QString> m_userDescription;
|
||||
caf::PdmField<QString> m_userDescription;
|
||||
|
||||
caf::PdmField<cvf::Color3f> m_color;
|
||||
caf::PdmField<bool> m_enableOpacity;
|
||||
caf::PdmField<double> m_opacity;
|
||||
|
||||
cvf::ref<RigSurface> m_surfaceData;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user