Refactors selection handling for improved code clarity

Modernize the interface to selection system. Create and return data instead of populating incoming parameters.
This commit is contained in:
Magne Sjaastad committed 2025-04-09 07:21:54 +02:00
1 parent 380f559f0d
commit ae8446073b
136 files changed
+357 -870

No files matched your search

@@ -32,10 +32,8 @@ CAF_CMD_SOURCE_INIT( RicDeleteWellPathTargetFeature, "RicDeleteWellPathTargetFea
//--------------------------------------------------------------------------------------------------
bool RicDeleteWellPathTargetFeature::isCommandEnabled() const
{
std::vector<RimWellPathTarget*> objects;
caf::SelectionManager::instance()->objectsByType( &objects, caf::SelectionManager::FIRST_LEVEL );
return !objects.empty();
const auto targets = caf::SelectionManager::instance()->objectsByType<RimWellPathTarget>();
return !targets.empty();
}
//--------------------------------------------------------------------------------------------------
@@ -43,9 +41,7 @@ bool RicDeleteWellPathTargetFeature::isCommandEnabled() const
//--------------------------------------------------------------------------------------------------
void RicDeleteWellPathTargetFeature::onActionTriggered( bool isChecked )
{
std::vector<RimWellPathTarget*> targets;
caf::SelectionManager::instance()->objectsByType( &targets, caf::SelectionManager::FIRST_LEVEL );
const auto targets = caf::SelectionManager::instance()->objectsByType<RimWellPathTarget>();
if ( !targets.empty() )
{
RimWellPathGeometryDef* wellGeomDef = targets[0]->firstAncestorOrThisOfTypeAsserted<RimWellPathGeometryDef>();