Move method to CPP file

This commit is contained in:
Bjørn Erik Jensen
2017-10-06 07:41:48 +02:00
parent fba1d068e9
commit 5f050448f9
2 changed files with 19 additions and 25 deletions

View File

@@ -50,6 +50,25 @@
CAF_CMD_SOURCE_INIT(RicNewRftPlotFeature, "RicNewRftPlotFeature"); CAF_CMD_SOURCE_INIT(RicNewRftPlotFeature, "RicNewRftPlotFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename T>
static T selectedPdmObject()
{
T objToFind = nullptr;
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
if (objHandle)
{
objHandle->firstAncestorOrThisOfType(objToFind);
}
return objToFind;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -29,10 +29,6 @@ class RimWellPath;
class RimRftPlotCollection; class RimRftPlotCollection;
class RimWellRftPlot; class RimWellRftPlot;
namespace caf
{
class PdmUiItem;
}
//================================================================================================== //==================================================================================================
/// ///
@@ -52,26 +48,5 @@ private:
RimWellPath* selectedWellPath() const; RimWellPath* selectedWellPath() const;
RimEclipseWell* selectedSimulationWell(int * branchIndex) const; RimEclipseWell* selectedSimulationWell(int * branchIndex) const;
bool caseAvailable() const; bool caseAvailable() const;
template<typename T>
T selectedPdmObject() const;
}; };
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template<typename T>
T RicNewRftPlotFeature::selectedPdmObject() const
{
T objToFind = nullptr;
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
if (objHandle)
{
objHandle->firstAncestorOrThisOfType(objToFind);
}
return objToFind;
}