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

@@ -283,6 +283,14 @@ RiuWellPathSelectionItem::RiuWellPathSelectionItem( const RivWellPathSourceInfo*
m_wellpath = wellPathSourceInfo->wellPath();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellPathSelectionItem* RiuWellPathSelectionItem::wellPathSelectionItem()
{
return Riu3dSelectionManager::instance()->objectByType<RiuWellPathSelectionItem>( Riu3dSelectionManager::RUI_TEMPORARY );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -84,6 +84,12 @@ public:
bool isEmpty( int role = RUI_APPLICATION_GLOBAL ) const;
template <typename T>
T* objectByType( int role ) const
{
return dynamic_cast<T*>( selectedItem( role ) );
}
private:
Riu3dSelectionManager();
~Riu3dSelectionManager();
@@ -243,6 +249,8 @@ public:
RiuSelectionType type() const override { return WELLPATH_SELECTION_OBJECT; }
static RiuWellPathSelectionItem* wellPathSelectionItem();
public:
RimWellPath* m_wellpath;
cvf::Vec3d m_pipeCenterlineIntersectionInDomainCoords;