mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Janitor : Encapsulate dynamic cast to selection item type
This commit is contained in:
@@ -40,7 +40,7 @@ CAF_CMD_SOURCE_INIT( RicNewFishbonesSubsAtMeasuredDepthFeature, "RicNewFishbones
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewFishbonesSubsAtMeasuredDepthFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RiuWellPathSelectionItem* wellPathSelItem = wellPathSelectionItem();
|
||||
RiuWellPathSelectionItem* wellPathSelItem = RiuWellPathSelectionItem::wellPathSelectionItem();
|
||||
CVF_ASSERT( wellPathSelItem );
|
||||
|
||||
RimWellPath* wellPath = wellPathSelItem->m_wellpath;
|
||||
@@ -63,19 +63,6 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::onActionTriggered( bool isChecke
|
||||
proj->reloadCompletionTypeResultsInAllViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWellPathSelectionItem* RicNewFishbonesSubsAtMeasuredDepthFeature::wellPathSelectionItem()
|
||||
{
|
||||
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem( Riu3dSelectionManager::RUI_TEMPORARY );
|
||||
|
||||
RiuWellPathSelectionItem* wellPathItem = dynamic_cast<RiuWellPathSelectionItem*>( selItem );
|
||||
|
||||
return wellPathItem;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -90,7 +77,7 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::setupActionLook( QAction* action
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewFishbonesSubsAtMeasuredDepthFeature::isCommandEnabled()
|
||||
{
|
||||
if ( wellPathSelectionItem() )
|
||||
if ( RiuWellPathSelectionItem::wellPathSelectionItem() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RiuWellPathSelectionItem;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@@ -33,7 +31,4 @@ protected:
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
bool isCommandEnabled() override;
|
||||
|
||||
private:
|
||||
static RiuWellPathSelectionItem* wellPathSelectionItem();
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ CAF_CMD_SOURCE_INIT( RicNewPerforationIntervalAtMeasuredDepthFeature, "RicNewPer
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewPerforationIntervalAtMeasuredDepthFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RiuWellPathSelectionItem* wellPathSelItem = wellPathSelectionItem();
|
||||
RiuWellPathSelectionItem* wellPathSelItem = RiuWellPathSelectionItem::wellPathSelectionItem();
|
||||
CVF_ASSERT( wellPathSelItem );
|
||||
|
||||
RimWellPath* wellPath = wellPathSelItem->m_wellpath;
|
||||
@@ -64,19 +64,6 @@ void RicNewPerforationIntervalAtMeasuredDepthFeature::onActionTriggered( bool is
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( perforationInterval );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWellPathSelectionItem* RicNewPerforationIntervalAtMeasuredDepthFeature::wellPathSelectionItem()
|
||||
{
|
||||
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem( Riu3dSelectionManager::RUI_TEMPORARY );
|
||||
|
||||
RiuWellPathSelectionItem* wellPathItem = dynamic_cast<RiuWellPathSelectionItem*>( selItem );
|
||||
|
||||
return wellPathItem;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -91,7 +78,7 @@ void RicNewPerforationIntervalAtMeasuredDepthFeature::setupActionLook( QAction*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewPerforationIntervalAtMeasuredDepthFeature::isCommandEnabled()
|
||||
{
|
||||
if ( wellPathSelectionItem() )
|
||||
if ( RiuWellPathSelectionItem::wellPathSelectionItem() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,4 @@ protected:
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
bool isCommandEnabled() override;
|
||||
|
||||
private:
|
||||
static RiuWellPathSelectionItem* wellPathSelectionItem();
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ CAF_CMD_SOURCE_INIT( RicNewValveAtMeasuredDepthFeature, "RicNewValveAtMeasuredDe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewValveAtMeasuredDepthFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RiuWellPathSelectionItem* wellPathSelItem = wellPathSelectionItem();
|
||||
RiuWellPathSelectionItem* wellPathSelItem = RiuWellPathSelectionItem::wellPathSelectionItem();
|
||||
CVF_ASSERT( wellPathSelItem );
|
||||
|
||||
RimWellPath* wellPath = wellPathSelItem->m_wellpath;
|
||||
@@ -91,23 +91,11 @@ void RicNewValveAtMeasuredDepthFeature::setupActionLook( QAction* actionToSetup
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewValveAtMeasuredDepthFeature::isCommandEnabled()
|
||||
{
|
||||
if ( wellPathSelectionItem() && dynamic_cast<RimPerforationInterval*>( wellPathSelectionItem()->m_wellPathComponent ) )
|
||||
auto wellPathSelectionItem = RiuWellPathSelectionItem::wellPathSelectionItem();
|
||||
if ( wellPathSelectionItem && dynamic_cast<RimPerforationInterval*>( wellPathSelectionItem->m_wellPathComponent ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWellPathSelectionItem* RicNewValveAtMeasuredDepthFeature::wellPathSelectionItem()
|
||||
{
|
||||
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem( Riu3dSelectionManager::RUI_TEMPORARY );
|
||||
|
||||
RiuWellPathSelectionItem* wellPathItem = dynamic_cast<RiuWellPathSelectionItem*>( selItem );
|
||||
|
||||
return wellPathItem;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RiuWellPathSelectionItem;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
@@ -33,7 +31,4 @@ protected:
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
bool isCommandEnabled() override;
|
||||
|
||||
private:
|
||||
static RiuWellPathSelectionItem* wellPathSelectionItem();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user