Janitor : Encapsulate dynamic cast to selection item type

This commit is contained in:
Magne Sjaastad
2021-06-29 09:59:45 +02:00
parent 96ac51c011
commit 3a1f2c8a05
12 changed files with 27 additions and 85 deletions

View File

@@ -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;
}