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:
Magne Sjaastad
2023-05-12 21:41:34 +02:00
committed by GitHub
parent 37e29a0f68
commit 0c90f67dcc
510 changed files with 1651 additions and 3111 deletions

View File

@@ -66,13 +66,11 @@ void RicNewWellPathAttributeFeature::onActionTriggered( bool isChecked )
RimWellPathAttribute* attribute = nullptr;
if ( attributes.size() == 1u )
{
RimWellPathAttributeCollection* attributeCollection = nullptr;
attributes[0]->firstAncestorOrThisOfTypeAsserted( attributeCollection );
auto attributeCollection = attributes[0]->firstAncestorOrThisOfTypeAsserted<RimWellPathAttributeCollection>();
attribute = new RimWellPathAttribute;
RimWellPath* wellPath = nullptr;
attributeCollection->firstAncestorOrThisOfTypeAsserted( wellPath );
attribute = new RimWellPathAttribute;
auto wellPath = attributeCollection->firstAncestorOrThisOfType<RimWellPath>();
attribute->setDepthsFromWellPath( wellPath );
attributeCollection->insertAttribute( attributes[0], attribute );
@@ -83,8 +81,8 @@ void RicNewWellPathAttributeFeature::onActionTriggered( bool isChecked )
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimWellPath>();
if ( wellPath )
{
std::vector<RimWellPathAttributeCollection*> attributeCollections;
wellPath->descendantsIncludingThisOfType( attributeCollections );
std::vector<RimWellPathAttributeCollection*> attributeCollections =
wellPath->descendantsIncludingThisOfType<RimWellPathAttributeCollection>();
if ( !attributeCollections.empty() )
{
attribute = new RimWellPathAttribute;
@@ -101,8 +99,7 @@ void RicNewWellPathAttributeFeature::onActionTriggered( bool isChecked )
if ( attribute )
{
RimProject* project = nullptr;
attribute->firstAncestorOrThisOfTypeAsserted( project );
RimProject* project = RimProject::current();
project->scheduleCreateDisplayModelAndRedrawAllViews();
}
}