Skip to content

Commit

Permalink
#11482 Add fault mesh line thickness option
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Jun 6, 2024
1 parent c868fa0 commit c4c8915
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ void RivFaultPartMgr::updatePartEffect()

cvf::ref<cvf::Effect> eff;
caf::MeshEffectGenerator faultEffGen( prefs->defaultFaultGridLineColors() );
faultEffGen.setLineWidth( m_rimFaultCollection->meshLineThickness() );

eff = faultEffGen.generateCachedEffect();

if ( m_nativeFaultGridLines.notNull() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "cafPdmFieldCvfColor.h"
#include "cafPdmFieldCvfMat4d.h"
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiTreeOrdering.h"

namespace caf
Expand Down Expand Up @@ -73,6 +74,7 @@ RimFaultInViewCollection::RimFaultInViewCollection()
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showOppositeFaultFaces );

CAF_PDM_InitField( &m_applyCellFilters, "ApplyCellFilters", true, "Use Cell Filters for Faults" );
CAF_PDM_InitField( &m_meshLineThickness, "MeshLineThickness", 2, "Mesh Line Thickness [1..10]" );

CAF_PDM_InitField( &m_onlyShowWithNeighbor, "OnlyShowWithDefNeighbor", false, "Show Only Faces with Juxtaposition" );
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_onlyShowWithNeighbor );
Expand Down Expand Up @@ -184,6 +186,14 @@ bool RimFaultInViewCollection::hideNNCsWhenNoResultIsAvailable() const
return m_hideNNCsWhenNoResultIsAvailable();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimFaultInViewCollection::meshLineThickness() const
{
return m_meshLineThickness();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand All @@ -205,7 +215,7 @@ void RimFaultInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* chan
if ( &m_showFaultFaces == changedField || &m_showOppositeFaultFaces == changedField || &m_showFaultCollection == changedField ||
&m_showFaultLabel == changedField || &m_applyCellFilters == changedField || &m_faultLabelColor == changedField ||
&m_onlyShowWithNeighbor == changedField || &m_faultResult == changedField || &m_showNNCs == changedField ||
&m_hideNNCsWhenNoResultIsAvailable == changedField )
&m_hideNNCsWhenNoResultIsAvailable == changedField || changedField == &m_meshLineThickness )
{
parentView()->scheduleCreateDisplayModelAndRedraw();
parentView()->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
Expand All @@ -225,6 +235,20 @@ caf::PdmFieldHandle* RimFaultInViewCollection::objectToggleField()
return &m_showFaultCollection;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultInViewCollection::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
{
if ( field == &m_meshLineThickness )
{
if ( auto* lineEditorAttr = dynamic_cast<caf::PdmUiLineEditorAttribute*>( attribute ) )
{
lineEditorAttr->validator = new QIntValidator( 1, 10, nullptr );
}
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -371,6 +395,7 @@ void RimFaultInViewCollection::defineUiOrdering( QString uiConfigName, caf::PdmU
{
caf::PdmUiGroup* general = uiOrdering.addNewGroup( "General" );
general->add( &m_applyCellFilters );
general->add( &m_meshLineThickness );

caf::PdmUiGroup* labs = uiOrdering.addNewGroup( "Fault Labels" );
labs->add( &m_showFaultLabel );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class RimFaultInViewCollection : public caf::PdmObject
bool showOppositeFaultFaces() const;
bool showNNCs() const;
bool hideNNCsWhenNoResultIsAvailable() const;
int meshLineThickness() const;

void setFaultResult( caf::AppEnum<FaultFaceCullingMode> resultType );
void setShouldApplyCellFiltersToFaults( bool bEnabled );
Expand All @@ -86,6 +87,7 @@ class RimFaultInViewCollection : public caf::PdmObject
private:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
caf::PdmFieldHandle* objectToggleField() override;
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;

void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
Expand All @@ -103,6 +105,7 @@ class RimFaultInViewCollection : public caf::PdmObject
caf::PdmField<bool> m_showFaultCollection;
caf::PdmField<bool> m_showNNCs;
caf::PdmField<bool> m_hideNNCsWhenNoResultIsAvailable;
caf::PdmField<int> m_meshLineThickness;

caf::PdmField<caf::AppEnum<FaultFaceCullingMode>> m_faultResult;

Expand Down

0 comments on commit c4c8915

Please sign in to comment.