Files
ResInsight/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInView.cpp
T
Kristian Bendiksen b274641e0c #14198 Exclude ResInsight-generated faults from default fault distance selection
When a new Fault Distance defaults to all faults, the ResInsight-generated
undefined grid faults were ticked by default. Add RimFaultInView::isGeneratedFault
and filter these faults out of the default selection in both the UI feature and
the Python command. An explicit fault selection is still honored.
2026-06-10 13:11:16 +02:00

142 lines
5.5 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimFaultInView.h"
#include "RiaResultNames.h"
#include "RigFault.h"
#include "RimEclipseView.h"
#include "RimIntersectionCollection.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
CAF_PDM_SOURCE_INIT( RimFaultInView, "Fault" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFaultInView::RimFaultInView()
{
CAF_PDM_InitScriptableObjectWithNameAndComment( "RimFault",
":/draw_style_faults_24x24.png",
"",
"",
"FaultInView",
"A fault belonging to a view's fault collection" );
CAF_PDM_InitScriptableFieldNoDefault( &name, "FaultName", "Name" );
name.uiCapability()->setUiHidden( true );
name.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitField( &showFault, "ShowFault", true, "Show Fault" );
showFault.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &faultColor, "Color", cvf::Color3f( 0.588f, 0.588f, 0.804f ), "Fault Color" );
m_rigFault = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFaultInView::~RimFaultInView()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimFaultInView::userDescriptionField()
{
return &name;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
{
updateUiIconFromToggleField();
if ( &faultColor == changedField || &showFault == changedField )
{
auto reservoirView = firstAncestorOrThisOfType<RimEclipseView>();
if ( reservoirView )
{
reservoirView->scheduleCreateDisplayModelAndRedraw();
reservoirView->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultInView::initAfterRead()
{
updateUiIconFromToggleField();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimFaultInView::objectToggleField()
{
return &showFault;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultInView::setFaultGeometry( const RigFault* faultGeometry )
{
m_rigFault = faultGeometry;
name = faultGeometry->name();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigFault* RimFaultInView::faultGeometry() const
{
return m_rigFault;
}
//--------------------------------------------------------------------------------------------------
/// True for the faults synthesized by ResInsight (undefined grid faults), as opposed to faults
/// imported from the Eclipse model.
//--------------------------------------------------------------------------------------------------
bool RimFaultInView::isGeneratedFault() const
{
return name() == RiaResultNames::undefinedGridFaultName() || name() == RiaResultNames::undefinedGridFaultWithInactiveName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultInView::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const
{
menuBuilder << "RicNewFaultDistanceResultFeature";
}