mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add fault reactivation modeling
This commit is contained in:
committed by
Kristian Bendiksen
parent
14c37c4b2c
commit
32326bfa9b
@@ -1,11 +1,15 @@
|
||||
set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultInViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationModel.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationModelCollection.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultInViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationModel.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationModelCollection.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -0,0 +1,450 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 Equinor ASA
|
||||
//
|
||||
// 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 "RimFaultReactivationModel.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferencesGeoMech.h"
|
||||
|
||||
#include "RigBasicPlane.h"
|
||||
#include "RigFaultReactivationModel.h"
|
||||
#include "RigPolyLinesData.h"
|
||||
|
||||
#include "WellPathCommands/PointTangentManipulator/RicPolyline3dEditor.h"
|
||||
#include "WellPathCommands/RicPolylineTargetsPickEventHandler.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "RivFaultReactivationModelPartMgr.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFaultInView.h"
|
||||
#include "RimFaultInViewCollection.h"
|
||||
#include "RimPolylineTarget.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
#include "cafPdmUiTableViewEditor.h"
|
||||
|
||||
#include "cvfPlane.h"
|
||||
#include "cvfTextureImage.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimFaultReactivationModel, "FaultReactivationModel" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultReactivationModel::RimFaultReactivationModel()
|
||||
: m_pickTargetsEventHandler( new RicPolylineTargetsPickEventHandler( this ) )
|
||||
{
|
||||
CAF_PDM_InitObject( "Fault Reactivation Model", ":/fault_react_24x24.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_userDescription, "UserDescription", QString( "Model" ), "Name" );
|
||||
|
||||
CAF_PDM_InitField( &m_extentHorizontal, "HorizontalExtent", 1000.0, "Horizontal Extent" );
|
||||
CAF_PDM_InitField( &m_extentVerticalAbove, "VerticalExtentAbove", 200.0, "Vertical Extent Above Anchor" );
|
||||
m_extentVerticalAbove.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
m_extentVerticalAbove.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::TOP );
|
||||
|
||||
CAF_PDM_InitField( &m_extentVerticalBelow, "VerticalExtentBelow", 200.0, "Vertical Extent Below Anchor" );
|
||||
m_extentVerticalBelow.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
m_extentVerticalBelow.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::TOP );
|
||||
|
||||
CAF_PDM_InitField( &m_modelExtentFromAnchor, "ModelExtentFromAnchor", 1000.0, "Horz. Extent from Anchor" );
|
||||
CAF_PDM_InitField( &m_modelMinZ, "ModelMinZ", 0.0, "Start Depth" );
|
||||
CAF_PDM_InitField( &m_modelBelowSize, "ModelBelowSize", 500.0, "Depth Below Fault" );
|
||||
|
||||
CAF_PDM_InitField( &m_showFaultPlane, "ShowFaultPlane", true, "Show Fault Plane" );
|
||||
CAF_PDM_InitField( &m_showModelPlane, "ShowModelPlane", false, "Show 2D Model" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_fault, "Fault", "Fault" );
|
||||
m_fault.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitField( &m_faultPlaneColor, "FaultPlaneColor", cvf::Color3f( cvf::Color3f::GRAY ), "Plane Color" );
|
||||
CAF_PDM_InitField( &m_modelPart1Color, "ModelPart1Color", cvf::Color3f( cvf::Color3f::GREEN ), "Part 1 Color" );
|
||||
CAF_PDM_InitField( &m_modelPart2Color, "ModelPart2Color", cvf::Color3f( cvf::Color3f::BLUE ), "Part 2 Color" );
|
||||
|
||||
CAF_PDM_InitField( &m_numberOfCellsHorzPart1, "NumberOfCellsHorzPart1", 20, "Horizontal Number of Cells, Part 1" );
|
||||
CAF_PDM_InitField( &m_numberOfCellsHorzPart2, "NumberOfCellsHorzPart2", 20, "Horizontal Number of Cells, Part 2" );
|
||||
CAF_PDM_InitField( &m_numberOfCellsVertUp, "NumberOfCellsVertUp", 20, "Vertical Number of Cells, Upper Part" );
|
||||
CAF_PDM_InitField( &m_numberOfCellsVertMid, "NumberOfCellsVertMid", 20, "Vertical Number of Cells, Middle Part" );
|
||||
CAF_PDM_InitField( &m_numberOfCellsVertLow, "NumberOfCellsVertLow", 20, "Vertical Number of Cells, Lower Part" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_targets, "Targets", "Targets" );
|
||||
m_targets.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() );
|
||||
m_targets.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_targets.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
m_targets.uiCapability()->setCustomContextMenuEnabled( false );
|
||||
|
||||
this->setUi3dEditorTypeName( RicPolyline3dEditor::uiEditorTypeName() );
|
||||
this->uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
setDeletable( true );
|
||||
|
||||
m_faultPlane = new RigBasicPlane();
|
||||
m_modelPlane = new RigFaultReactivationModel();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultReactivationModel::~RimFaultReactivationModel()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::initAfterRead()
|
||||
{
|
||||
updateVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultReactivationModel::userDescription()
|
||||
{
|
||||
return m_userDescription;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::setUserDescription( QString description )
|
||||
{
|
||||
m_userDescription = description;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimFaultReactivationModel::userDescriptionField()
|
||||
{
|
||||
return &m_userDescription;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::setFault( RimFaultInView* fault )
|
||||
{
|
||||
m_fault = fault;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultInView* RimFaultReactivationModel::fault() const
|
||||
{
|
||||
return m_fault();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::setTargets( cvf::Vec3d target1, cvf::Vec3d target2 )
|
||||
{
|
||||
m_targets.deleteChildren();
|
||||
|
||||
RimPolylineTarget* planeCenter = new RimPolylineTarget();
|
||||
planeCenter->setAsPointXYZ( target1 );
|
||||
|
||||
m_targets.push_back( planeCenter );
|
||||
|
||||
RimPolylineTarget* steeringTarget = new RimPolylineTarget();
|
||||
steeringTarget->setAsPointXYZ( target2 );
|
||||
|
||||
m_targets.push_back( steeringTarget );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPolylineTarget*> RimFaultReactivationModel::activeTargets() const
|
||||
{
|
||||
return m_targets.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert )
|
||||
{
|
||||
// do nothing, we should only have 2 predefined targets
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::deleteTarget( RimPolylineTarget* targetToDelete )
|
||||
{
|
||||
// do nothing, we should always have 2 predefined targets
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModel::pickingEnabled() const
|
||||
{
|
||||
// never pick, we only have our 2 predefined targets
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PickEventHandler* RimFaultReactivationModel::pickEventHandler() const
|
||||
{
|
||||
return m_pickTargetsEventHandler.get();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::updateVisualization()
|
||||
{
|
||||
auto view = firstAncestorOrThisOfType<Rim3dView>();
|
||||
if ( !view ) return;
|
||||
|
||||
auto normal = m_targets[1]->targetPointXYZ() - m_targets[0]->targetPointXYZ();
|
||||
normal.z() = normal.z() * view->scaleZ() * view->scaleZ();
|
||||
normal.normalize();
|
||||
|
||||
m_faultPlane->setPlane( m_targets[0]->targetPointXYZ(), normal );
|
||||
m_faultPlane->setMaxExtentFromAnchor( m_extentHorizontal, m_extentVerticalAbove, m_extentVerticalBelow );
|
||||
m_faultPlane->setColor( m_faultPlaneColor );
|
||||
m_faultPlane->updateRect();
|
||||
|
||||
double maxZ = m_faultPlane->maxDepth();
|
||||
auto [topInt, bottomInt] = m_faultPlane->intersectTopBottomLine();
|
||||
|
||||
cvf::Vec3d zdir( 0, 0, 1 );
|
||||
auto modelNormal = normal ^ zdir;
|
||||
modelNormal.normalize();
|
||||
|
||||
m_modelPlane->setPlane( m_targets[0]->targetPointXYZ(), modelNormal );
|
||||
m_modelPlane->setFaultPlaneIntersect( topInt, bottomInt );
|
||||
m_modelPlane->setMaxExtentFromAnchor( m_modelExtentFromAnchor, m_modelMinZ, maxZ + m_modelBelowSize );
|
||||
m_modelPlane->setPartColors( m_modelPart1Color, m_modelPart2Color );
|
||||
m_modelPlane->setCellCounts( m_numberOfCellsHorzPart1,
|
||||
m_numberOfCellsHorzPart2,
|
||||
m_numberOfCellsVertUp,
|
||||
m_numberOfCellsVertMid,
|
||||
m_numberOfCellsVertLow );
|
||||
m_modelPlane->updateRects();
|
||||
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::updateEditorsAndVisualization()
|
||||
{
|
||||
updateConnectedEditors();
|
||||
updateVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigPolyLinesData> RimFaultReactivationModel::polyLinesData() const
|
||||
{
|
||||
cvf::ref<RigPolyLinesData> pld = new RigPolyLinesData;
|
||||
|
||||
std::vector<cvf::Vec3d> line;
|
||||
for ( const RimPolylineTarget* target : m_targets )
|
||||
{
|
||||
line.push_back( target->targetPointXYZ() );
|
||||
}
|
||||
pld->setPolyLine( line );
|
||||
|
||||
return pld;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimFaultReactivationModel::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_fault )
|
||||
{
|
||||
if ( m_fault() != nullptr )
|
||||
{
|
||||
auto coll = m_fault->firstAncestorOrThisOfType<RimFaultInViewCollection>();
|
||||
if ( coll != nullptr ) RimTools::faultOptionItems( &options, coll );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivFaultReactivationModelPartMgr* RimFaultReactivationModel::partMgr()
|
||||
{
|
||||
if ( m_partMgr.isNull() ) m_partMgr = new RivFaultReactivationModelPartMgr( this );
|
||||
|
||||
return m_partMgr.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigBasicPlane> RimFaultReactivationModel::faultPlane() const
|
||||
{
|
||||
return m_faultPlane;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigFaultReactivationModel> RimFaultReactivationModel::model() const
|
||||
{
|
||||
return m_modelPlane;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModel::showFaultPlane() const
|
||||
{
|
||||
return m_showFaultPlane;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModel::showModel() const
|
||||
{
|
||||
return m_showModelPlane;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
auto genGrp = uiOrdering.addNewGroup( "General" );
|
||||
genGrp->add( &m_userDescription );
|
||||
genGrp->add( &m_fault );
|
||||
|
||||
auto faultGrp = uiOrdering.addNewGroup( "Fault Plane" );
|
||||
|
||||
faultGrp->add( &m_showFaultPlane );
|
||||
faultGrp->add( &m_faultPlaneColor );
|
||||
faultGrp->add( &m_extentHorizontal );
|
||||
faultGrp->add( &m_extentVerticalAbove );
|
||||
faultGrp->add( &m_extentVerticalBelow );
|
||||
|
||||
auto modelGrp = uiOrdering.addNewGroup( "2D Model" );
|
||||
modelGrp->add( &m_showModelPlane );
|
||||
|
||||
auto sizeModelGrp = modelGrp->addNewGroup( "Size" );
|
||||
sizeModelGrp->add( &m_modelExtentFromAnchor );
|
||||
sizeModelGrp->add( &m_modelMinZ );
|
||||
sizeModelGrp->add( &m_modelBelowSize );
|
||||
|
||||
auto gridModelGrp = modelGrp->addNewGroup( "Grid" );
|
||||
|
||||
gridModelGrp->add( &m_numberOfCellsHorzPart1 );
|
||||
gridModelGrp->add( &m_numberOfCellsHorzPart2 );
|
||||
gridModelGrp->add( &m_numberOfCellsVertUp );
|
||||
gridModelGrp->add( &m_numberOfCellsVertMid );
|
||||
gridModelGrp->add( &m_numberOfCellsVertLow );
|
||||
|
||||
auto appModelGrp = modelGrp->addNewGroup( "Appearance" );
|
||||
appModelGrp->add( &m_modelPart1Color );
|
||||
appModelGrp->add( &m_modelPart2Color );
|
||||
|
||||
auto trgGroup = uiOrdering.addNewGroup( "Debug" );
|
||||
trgGroup->setCollapsedByDefault();
|
||||
trgGroup->add( &m_targets );
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_userDescription )
|
||||
{
|
||||
updateConnectedEditors();
|
||||
}
|
||||
else
|
||||
{
|
||||
updateVisualization();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModel::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_targets )
|
||||
{
|
||||
auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>( attribute );
|
||||
if ( tvAttribute )
|
||||
{
|
||||
tvAttribute->resizePolicy = caf::PdmUiTableViewEditorAttribute::RESIZE_TO_FIT_CONTENT;
|
||||
}
|
||||
}
|
||||
else if ( ( field == &m_extentVerticalAbove ) || ( field == &m_extentVerticalBelow ) )
|
||||
{
|
||||
auto* attr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute );
|
||||
|
||||
if ( attr )
|
||||
{
|
||||
auto eclCase = eclipseCase();
|
||||
if ( eclCase )
|
||||
{
|
||||
auto bb = eclCase->allCellsBoundingBox();
|
||||
double diff = bb.max().z() - bb.min().z();
|
||||
attr->m_minimum = 0;
|
||||
attr->m_maximum = diff;
|
||||
}
|
||||
else
|
||||
{
|
||||
attr->m_minimum = 0;
|
||||
attr->m_maximum = 1000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RimFaultReactivationModel::eclipseCase()
|
||||
{
|
||||
auto activeView = dynamic_cast<RimEclipseView*>( RiaApplication::instance()->activeGridView() );
|
||||
if ( activeView )
|
||||
{
|
||||
return activeView->eclipseCase();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 Equinor ASA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RimCheckableNamedObject.h"
|
||||
#include "RimPolylinePickerInterface.h"
|
||||
#include "RimPolylinesDataInterface.h"
|
||||
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "cvfColor3.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
class RicPolylineTargetsPickEventHandler;
|
||||
class RimEclipseCase;
|
||||
class RimFaultInView;
|
||||
class RimPolylineTarget;
|
||||
class RivFaultReactivationModelPartMgr;
|
||||
class RigBasicPlane;
|
||||
class RigFaultReactivationModel;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class BoundingBox;
|
||||
class Plane;
|
||||
} // namespace cvf
|
||||
|
||||
class RimFaultReactivationModel : public RimCheckableNamedObject, public RimPolylinePickerInterface, public RimPolylinesDataInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimFaultReactivationModel();
|
||||
~RimFaultReactivationModel() override;
|
||||
|
||||
QString userDescription();
|
||||
void setUserDescription( QString description );
|
||||
|
||||
void setFault( RimFaultInView* fault );
|
||||
RimFaultInView* fault() const;
|
||||
|
||||
void setTargets( cvf::Vec3d target1, cvf::Vec3d target2 );
|
||||
|
||||
RivFaultReactivationModelPartMgr* partMgr();
|
||||
|
||||
// polyline picker interface
|
||||
void insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert ) override;
|
||||
void deleteTarget( RimPolylineTarget* targetToDelete ) override;
|
||||
void updateEditorsAndVisualization() override;
|
||||
void updateVisualization() override;
|
||||
std::vector<RimPolylineTarget*> activeTargets() const override;
|
||||
bool pickingEnabled() const override;
|
||||
caf::PickEventHandler* pickEventHandler() const override;
|
||||
|
||||
// polyline data interface
|
||||
cvf::ref<RigPolyLinesData> polyLinesData() const override;
|
||||
|
||||
cvf::ref<RigBasicPlane> faultPlane() const;
|
||||
bool showFaultPlane() const;
|
||||
|
||||
cvf::ref<RigFaultReactivationModel> model() const;
|
||||
bool showModel() const;
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
RimEclipseCase* eclipseCase();
|
||||
|
||||
void initAfterRead() override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<RicPolylineTargetsPickEventHandler> m_pickTargetsEventHandler;
|
||||
|
||||
cvf::ref<RivFaultReactivationModelPartMgr> m_partMgr;
|
||||
|
||||
caf::PdmField<QString> m_userDescription;
|
||||
caf::PdmPtrField<RimFaultInView*> m_fault;
|
||||
caf::PdmChildArrayField<RimPolylineTarget*> m_targets;
|
||||
caf::PdmField<cvf::Color3f> m_faultPlaneColor;
|
||||
caf::PdmField<cvf::Color3f> m_modelPart1Color;
|
||||
caf::PdmField<cvf::Color3f> m_modelPart2Color;
|
||||
|
||||
caf::PdmField<bool> m_showFaultPlane;
|
||||
caf::PdmField<bool> m_showModelPlane;
|
||||
|
||||
caf::PdmField<double> m_extentVerticalAbove;
|
||||
caf::PdmField<double> m_extentVerticalBelow;
|
||||
caf::PdmField<double> m_extentHorizontal;
|
||||
caf::PdmField<double> m_modelExtentFromAnchor;
|
||||
caf::PdmField<double> m_modelMinZ;
|
||||
caf::PdmField<double> m_modelBelowSize;
|
||||
caf::PdmField<int> m_numberOfCellsHorzPart1;
|
||||
caf::PdmField<int> m_numberOfCellsHorzPart2;
|
||||
caf::PdmField<int> m_numberOfCellsVertUp;
|
||||
caf::PdmField<int> m_numberOfCellsVertMid;
|
||||
caf::PdmField<int> m_numberOfCellsVertLow;
|
||||
|
||||
cvf::ref<RigBasicPlane> m_faultPlane;
|
||||
cvf::ref<RigFaultReactivationModel> m_modelPlane;
|
||||
};
|
||||
@@ -0,0 +1,186 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 Equinor ASA
|
||||
//
|
||||
// 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 "RimFaultReactivationModelCollection.h"
|
||||
|
||||
#include "RiaPreferencesGeoMech.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimFaultInView.h"
|
||||
#include "RimFaultReactivationModel.h"
|
||||
|
||||
#include "RivFaultReactivationModelPartMgr.h"
|
||||
|
||||
#include "cvfBoundingBox.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimFaultReactivationModelCollection, "FaultReactivationModelCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultReactivationModelCollection::RimFaultReactivationModelCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Fault Reactivation Models", ":/fault_react_24x24.png" );
|
||||
|
||||
CAF_PDM_InitField( &m_userDescription, "UserDescription", QString( "Fault Reactivation Models" ), "Name" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_models, "FaultReactivationModels", "Models" );
|
||||
m_models.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
setName( "Fault Reactivation Models" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultReactivationModelCollection::~RimFaultReactivationModelCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultReactivationModel* RimFaultReactivationModelCollection::addNewModel( RimFaultInView* fault, cvf::Vec3d target1, cvf::Vec3d target2 )
|
||||
{
|
||||
auto newModel = new RimFaultReactivationModel();
|
||||
newModel->setFault( fault );
|
||||
newModel->setUserDescription( fault->name() );
|
||||
newModel->setTargets( target1, target2 );
|
||||
|
||||
m_models.push_back( newModel );
|
||||
|
||||
newModel->updateVisualization();
|
||||
|
||||
// updateView();
|
||||
return newModel;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModelCollection::empty()
|
||||
{
|
||||
return m_models.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimFaultReactivationModelCollection::size()
|
||||
{
|
||||
return static_cast<int>( m_models.size() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultReactivationModelCollection::userDescription()
|
||||
{
|
||||
return m_userDescription;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModelCollection::setUserDescription( QString description )
|
||||
{
|
||||
m_userDescription = description;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimFaultReactivationModelCollection::userDescriptionField()
|
||||
{
|
||||
return &m_userDescription;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModelCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModelCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == objectToggleField() )
|
||||
{
|
||||
updateView();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModelCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
updateView();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModelCollection::updateView()
|
||||
{
|
||||
auto view = firstAncestorOrThisOfType<Rim3dView>();
|
||||
if ( view ) view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultReactivationModelCollection::shouldBeVisibleInTree() const
|
||||
{
|
||||
return RiaPreferencesGeoMech::current()->validateFRMSettings();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultReactivationModelCollection::appendPartsToModel( Rim3dView* view,
|
||||
cvf::ModelBasicList* model,
|
||||
caf::DisplayCoordTransform* transform,
|
||||
const cvf::BoundingBox& boundingBox )
|
||||
{
|
||||
if ( !isChecked() ) return;
|
||||
|
||||
for ( auto& frm : m_models )
|
||||
{
|
||||
if ( frm->isChecked() )
|
||||
{
|
||||
frm->partMgr()->appendPolylinePartsToModel( view, model, transform, boundingBox );
|
||||
frm->partMgr()->appendGeometryPartsToModel( model, transform, boundingBox );
|
||||
frm->partMgr()->appendMeshPartsToModel( view, model, transform, boundingBox );
|
||||
}
|
||||
}
|
||||
|
||||
model->updateBoundingBoxesRecursive();
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2023 Equinor ASA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RimCheckableNamedObject.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimFaultReactivationModel;
|
||||
class RimFaultInView;
|
||||
class Rim3dView;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ModelBasicList;
|
||||
class Transform;
|
||||
class BoundingBox;
|
||||
} // namespace cvf
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class DisplayCoordTransform;
|
||||
}
|
||||
|
||||
class RimFaultReactivationModelCollection : public RimCheckableNamedObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimFaultReactivationModelCollection();
|
||||
~RimFaultReactivationModelCollection() override;
|
||||
|
||||
RimFaultReactivationModel* addNewModel( RimFaultInView* fault, cvf::Vec3d target1, cvf::Vec3d target2 );
|
||||
|
||||
bool empty();
|
||||
int size();
|
||||
|
||||
bool shouldBeVisibleInTree() const;
|
||||
|
||||
QString userDescription();
|
||||
void setUserDescription( QString description );
|
||||
|
||||
void appendPartsToModel( Rim3dView* view,
|
||||
cvf::ModelBasicList* model,
|
||||
caf::DisplayCoordTransform* transform,
|
||||
const cvf::BoundingBox& boundingBox );
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
|
||||
void updateView();
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_userDescription;
|
||||
caf::PdmChildArrayField<RimFaultReactivationModel*> m_models;
|
||||
};
|
||||
Reference in New Issue
Block a user