mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Change API for PdmObjectHandle and PdmFieldHandle
* Refactor interface to PdmObjectHandle and PdmFieldHandle Return objects instead of passing in structures as parameters * Add nodiscard to several functions * Remove redundant this-> * Rename to ptrReferencedObjectsByType
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "RimWellRftPlot.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QColor>
|
||||
|
||||
@@ -58,8 +59,7 @@ std::vector<RimWellLogCurve*> RicWellLogPlotCurveFeatureImpl::selectedWellLogCur
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( selectedItem );
|
||||
if ( objHandle )
|
||||
{
|
||||
std::vector<RimWellLogTrack*> childTracks;
|
||||
objHandle->descendantsIncludingThisOfType( childTracks );
|
||||
std::vector<RimWellLogTrack*> childTracks = objHandle->descendantsIncludingThisOfType<RimWellLogTrack>();
|
||||
for ( auto track : childTracks )
|
||||
{
|
||||
if ( track->showWindow() )
|
||||
@@ -86,13 +86,7 @@ std::vector<RimWellLogCurve*> RicWellLogPlotCurveFeatureImpl::selectedWellLogCur
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot* RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()
|
||||
{
|
||||
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( !destinationObject ) return nullptr;
|
||||
|
||||
RimWellAllocationPlot* wellAllocationPlot = nullptr;
|
||||
destinationObject->firstAncestorOrThisOfType( wellAllocationPlot );
|
||||
|
||||
return wellAllocationPlot;
|
||||
return caf::firstAncestorOfTypeFromSelectedObject<RimWellAllocationPlot>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -100,13 +94,7 @@ RimWellAllocationPlot* RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellRftPlot* RicWellLogPlotCurveFeatureImpl::parentWellRftPlot()
|
||||
{
|
||||
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( !destinationObject ) return nullptr;
|
||||
|
||||
RimWellRftPlot* wellRftPlot = nullptr;
|
||||
destinationObject->firstAncestorOrThisOfType( wellRftPlot );
|
||||
|
||||
return wellRftPlot;
|
||||
return caf::firstAncestorOfTypeFromSelectedObject<RimWellRftPlot>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -114,11 +102,5 @@ RimWellRftPlot* RicWellLogPlotCurveFeatureImpl::parentWellRftPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellBoreStabilityPlot* RicWellLogPlotCurveFeatureImpl::parentWellBoreStabilityPlot()
|
||||
{
|
||||
caf::PdmObjectHandle* destinationObject = dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( !destinationObject ) return nullptr;
|
||||
|
||||
RimWellBoreStabilityPlot* wbsPlot = nullptr;
|
||||
destinationObject->firstAncestorOrThisOfType( wbsPlot );
|
||||
|
||||
return wbsPlot;
|
||||
return caf::firstAncestorOfTypeFromSelectedObject<RimWellBoreStabilityPlot>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user