mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-30 17:42:13 -06:00
Use polygon as data source for intersection
- Use polygon as data source for intersection - Add padlock icon - Show padlock icon on read only polygons - Add Fwk function appendMenuItems() to make it possible to define context menu content in a PdmObject - Context menu "Create Polygon Intersection" - Updates to make visualization consistent with object and object collection enabled state
This commit is contained in:
1 parent
09151ec6af
commit
28d281e1d6
45 files changed
+632
-125
No files matched your search
+76
-24
@@ -21,23 +21,20 @@
|
||||
|
||||
#include "RiaVec3Tools.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigPolyLinesData.h"
|
||||
#include "RigSimulationWellCenterLineCalculator.h"
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "Polygons/RimPolygon.h"
|
||||
#include "Polygons/RimPolygonCollection.h"
|
||||
#include "Polygons/RimPolygonTools.h"
|
||||
|
||||
#include "Rim2dIntersectionView.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEnsembleSurface.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimIntersectionResultDefinition.h"
|
||||
#include "RimIntersectionResultsDefinitionCollection.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
#include "RimSurface.h"
|
||||
@@ -48,12 +45,8 @@
|
||||
#include "RimTools.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "RivExtrudedCurveIntersectionPartMgr.h"
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmFieldScriptingCapabilityCvfVec3d.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
@@ -61,12 +54,9 @@
|
||||
#include "cafPdmUiDoubleSliderEditor.h"
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiSliderEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
#include "cvfBoundingBox.h"
|
||||
#include "cvfGeometryTools.h"
|
||||
#include "cvfPlane.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@@ -77,6 +67,7 @@ void caf::AppEnum<RimExtrudedCurveIntersection::CrossSectionEnum>::setUp()
|
||||
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_SIMULATION_WELL, "CS_SIMULATION_WELL", "Simulation Well" );
|
||||
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE, "CS_POLYLINE", "Polyline" );
|
||||
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_AZIMUTHLINE, "CS_AZIMUTHLINE", "Azimuth and Dip" );
|
||||
addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYGON, "CS_POLYGON", "Project Polygon" );
|
||||
setDefault( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE );
|
||||
}
|
||||
|
||||
@@ -186,6 +177,17 @@ void RimExtrudedCurveIntersection::configureForPolyLine()
|
||||
m_inputPolylineFromViewerEnabled = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimExtrudedCurveIntersection::configureForProjectPolyLine( RimPolygon* polygon )
|
||||
{
|
||||
m_type = CrossSectionEnum::CS_POLYGON;
|
||||
m_projectPolygon = polygon;
|
||||
|
||||
updateName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -207,6 +209,11 @@ RimExtrudedCurveIntersection::RimExtrudedCurveIntersection()
|
||||
CAF_PDM_InitFieldNoDefault( &m_direction, "Direction", "Direction" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_wellPath, "WellPath", "Well Path " );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_simulationWell, "SimulationWell", "Simulation Well" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_projectPolygon, "ProjectPolygon", "Project Polygon" );
|
||||
CAF_PDM_InitField( &m_editPolygonButton, "EditPolygonButton", false, "Edit" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_editPolygonButton );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_userPolylineXyz, "Points", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_userPolylineXydForUi, "PointsUi", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "" );
|
||||
@@ -439,11 +446,11 @@ void RimExtrudedCurveIntersection::setKFilterOverride( bool collectionOverride,
|
||||
void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_isActive || changedField == &m_type || changedField == &m_direction || changedField == &m_wellPath ||
|
||||
changedField == &m_simulationWell || changedField == &m_branchIndex || changedField == &m_extentLength ||
|
||||
changedField == &m_lengthUp || changedField == &m_lengthDown || changedField == &m_showInactiveCells ||
|
||||
changedField == &m_useSeparateDataSource || changedField == &m_separateDataSource || changedField == &m_depthUpperThreshold ||
|
||||
changedField == &m_depthLowerThreshold || changedField == &m_depthThresholdOverridden || changedField == &m_depthFilterType ||
|
||||
changedField == &m_enableKFilter || changedField == &m_kFilterText || changedField == &m_kFilterCollectionOverride )
|
||||
changedField == &m_simulationWell || changedField == &m_branchIndex || changedField == &m_extentLength || changedField == &m_lengthUp ||
|
||||
changedField == &m_lengthDown || changedField == &m_showInactiveCells || changedField == &m_useSeparateDataSource ||
|
||||
changedField == &m_separateDataSource || changedField == &m_depthUpperThreshold || changedField == &m_depthLowerThreshold ||
|
||||
changedField == &m_depthThresholdOverridden || changedField == &m_depthFilterType || changedField == &m_enableKFilter ||
|
||||
changedField == &m_kFilterText || changedField == &m_kFilterCollectionOverride || changedField == &m_projectPolygon )
|
||||
{
|
||||
rebuildGeometryAndScheduleCreateDisplayModel();
|
||||
}
|
||||
@@ -453,7 +460,8 @@ void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
recomputeSimulationWellBranchData();
|
||||
}
|
||||
|
||||
if ( changedField == &m_simulationWell || changedField == &m_wellPath || changedField == &m_branchIndex )
|
||||
if ( changedField == &m_simulationWell || changedField == &m_wellPath || changedField == &m_branchIndex ||
|
||||
changedField == &m_projectPolygon || changedField == &m_type )
|
||||
{
|
||||
updateName();
|
||||
}
|
||||
@@ -511,6 +519,15 @@ void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
{
|
||||
rebuildGeometryAndScheduleCreateDisplayModel();
|
||||
}
|
||||
|
||||
if ( changedField == &m_editPolygonButton )
|
||||
{
|
||||
RimPolygonTools::selectAndActivatePolygonInView( m_projectPolygon(), this );
|
||||
|
||||
m_editPolygonButton = false;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -540,6 +557,11 @@ void RimExtrudedCurveIntersection::defineUiOrdering( QString uiConfigName, caf::
|
||||
geometryGroup->add( &m_userPolylineXydForUi );
|
||||
geometryGroup->add( &m_inputPolylineFromViewerEnabled );
|
||||
}
|
||||
else if ( type() == CrossSectionEnum::CS_POLYGON )
|
||||
{
|
||||
geometryGroup->add( &m_projectPolygon );
|
||||
geometryGroup->add( &m_editPolygonButton, { .newRow = false } );
|
||||
}
|
||||
else if ( type() == CrossSectionEnum::CS_AZIMUTHLINE )
|
||||
{
|
||||
geometryGroup->add( &m_twoAzimuthPoints );
|
||||
@@ -668,6 +690,19 @@ QList<caf::PdmOptionItemInfo> RimExtrudedCurveIntersection::calculateValueOption
|
||||
options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_projectPolygon )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
|
||||
RimTools::polygonOptionItems( &options );
|
||||
|
||||
if ( m_projectPolygon() == nullptr )
|
||||
{
|
||||
auto polygonCollection = RimTools::polygonCollection();
|
||||
auto polygons = polygonCollection->allPolygons();
|
||||
if ( !polygons.empty() ) m_projectPolygon = polygons.front();
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_branchIndex )
|
||||
{
|
||||
updateSimulationWellCenterline();
|
||||
@@ -775,8 +810,6 @@ std::vector<std::vector<cvf::Vec3d>> RimExtrudedCurveIntersection::polyLines( cv
|
||||
{
|
||||
if ( m_simulationWell() )
|
||||
{
|
||||
updateSimulationWellCenterline();
|
||||
|
||||
int branchIndexToUse = branchIndex();
|
||||
|
||||
if ( 0 <= branchIndexToUse && branchIndexToUse < static_cast<int>( m_simulationWellBranchCenterlines.size() ) )
|
||||
@@ -794,6 +827,13 @@ std::vector<std::vector<cvf::Vec3d>> RimExtrudedCurveIntersection::polyLines( cv
|
||||
{
|
||||
lines.push_back( m_userPolylineXyz );
|
||||
}
|
||||
else if ( type() == CrossSectionEnum::CS_POLYGON )
|
||||
{
|
||||
if ( m_projectPolygon )
|
||||
{
|
||||
lines = m_projectPolygon->polyLinesData()->completePolyLines();
|
||||
}
|
||||
}
|
||||
else if ( type() == CrossSectionEnum::CS_AZIMUTHLINE )
|
||||
{
|
||||
lines.push_back( m_twoAzimuthPoints );
|
||||
@@ -863,7 +903,7 @@ std::vector<cvf::Vec3d> RimExtrudedCurveIntersection::polyLinesForExtrusionDirec
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimExtrudedCurveIntersection::updateSimulationWellCenterline() const
|
||||
void RimExtrudedCurveIntersection::updateSimulationWellCenterline()
|
||||
{
|
||||
if ( m_isActive() && type() == CrossSectionEnum::CS_SIMULATION_WELL && m_simulationWell() )
|
||||
{
|
||||
@@ -954,6 +994,10 @@ void RimExtrudedCurveIntersection::updateName()
|
||||
{
|
||||
m_name = m_wellPath()->name();
|
||||
}
|
||||
else if ( m_type() == CrossSectionEnum::CS_POLYGON && m_projectPolygon() )
|
||||
{
|
||||
m_name = m_projectPolygon->name();
|
||||
}
|
||||
|
||||
Rim2dIntersectionView* iView = correspondingIntersectionView();
|
||||
if ( iView )
|
||||
@@ -1081,6 +1125,14 @@ void RimExtrudedCurveIntersection::defineEditorAttribute( const caf::PdmFieldHan
|
||||
{
|
||||
setBaseColor( m_inputExtrusionPointsFromViewerEnabled, dynamic_cast<caf::PdmUiListEditorAttribute*>( attribute ) );
|
||||
}
|
||||
|
||||
if ( field == &m_editPolygonButton )
|
||||
{
|
||||
if ( auto attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) )
|
||||
{
|
||||
attrib->m_buttonText = "Edit";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user