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:
@@ -283,6 +283,14 @@ RiuWellPathSelectionItem::RiuWellPathSelectionItem( const RivWellPathSourceInfo*
|
||||
m_wellpath = wellPathSourceInfo->wellPath();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWellPathSelectionItem* RiuWellPathSelectionItem::wellPathSelectionItem()
|
||||
{
|
||||
return Riu3dSelectionManager::instance()->objectByType<RiuWellPathSelectionItem>( Riu3dSelectionManager::RUI_TEMPORARY );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user