mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -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:
@@ -19,7 +19,15 @@
|
||||
#include "RimPolygon.h"
|
||||
|
||||
#include "RigPolyLinesData.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimPolygonAppearance.h"
|
||||
#include "RimPolygonTools.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiTreeAttributes.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimPolygon, "RimPolygon" );
|
||||
|
||||
@@ -33,6 +41,10 @@ RimPolygon::RimPolygon()
|
||||
|
||||
CAF_PDM_InitField( &m_isReadOnly, "IsReadOnly", false, "Read Only" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_pointsInDomainCoords, "PointsInDomainCoords", "Points" );
|
||||
|
||||
CAF_PDM_InitField( &m_editPolygonButton, "EditPolygonButton", false, "Edit" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &m_editPolygonButton );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_appearance, "Appearance", "Appearance" );
|
||||
m_appearance = new RimPolygonAppearance;
|
||||
m_appearance.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
@@ -61,6 +73,15 @@ void RimPolygon::uiOrderingForLocalPolygon( QString uiConfigName, caf::PdmUiOrde
|
||||
m_appearance->uiOrdering( uiConfigName, uiOrdering );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygon::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const
|
||||
{
|
||||
menuBuilder << "RicNewPolygonIntersectionFeature";
|
||||
menuBuilder << "RicNewPolygonFilterFeature";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -95,6 +116,22 @@ bool RimPolygon::isClosed() const
|
||||
return m_appearance->isClosed();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygon::setReadOnly( bool isReadOnly )
|
||||
{
|
||||
m_isReadOnly = isReadOnly;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPolygon::isReadOnly() const
|
||||
{
|
||||
return m_isReadOnly();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -102,11 +139,14 @@ void RimPolygon::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiO
|
||||
{
|
||||
uiOrdering.add( nameField() );
|
||||
uiOrdering.add( &m_isReadOnly );
|
||||
uiOrdering.add( &m_editPolygonButton );
|
||||
|
||||
auto groupPoints = uiOrdering.addNewGroup( "Points" );
|
||||
groupPoints->setCollapsedByDefault();
|
||||
groupPoints->add( &m_pointsInDomainCoords );
|
||||
|
||||
m_pointsInDomainCoords.uiCapability()->setUiReadOnly( m_isReadOnly() );
|
||||
|
||||
auto group = uiOrdering.addNewGroup( "Appearance" );
|
||||
m_appearance->uiOrdering( uiConfigName, *group );
|
||||
}
|
||||
@@ -120,6 +160,16 @@ void RimPolygon::fieldChangedByUi( const caf::PdmFieldHandle* changedField, cons
|
||||
{
|
||||
objectChanged.send();
|
||||
}
|
||||
|
||||
if ( changedField == &m_editPolygonButton )
|
||||
{
|
||||
auto activeView = RiaApplication::instance()->activeReservoirView();
|
||||
RimPolygonTools::selectAndActivatePolygonInView( this, activeView );
|
||||
|
||||
m_editPolygonButton = false;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -129,3 +179,28 @@ void RimPolygon::childFieldChangedByUi( const caf::PdmFieldHandle* changedChildF
|
||||
{
|
||||
objectChanged.send();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygon::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_editPolygonButton )
|
||||
{
|
||||
if ( auto attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute ) )
|
||||
{
|
||||
attrib->m_buttonText = "Edit in Active View";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygon::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( m_isReadOnly )
|
||||
{
|
||||
caf::PdmUiTreeViewItemAttribute::createTagIfTreeViewItemAttribute( attribute, ":/padlock.svg" );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user