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

No files matched your search

@@ -136,8 +136,7 @@ void RimPerforationInterval::setSkinFactor( double skinFactor )
//--------------------------------------------------------------------------------------------------
double RimPerforationInterval::diameter( RiaDefines::EclipseUnitSystem unitSystem ) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
if ( unitSystem == RiaDefines::EclipseUnitSystem::UNITS_METRIC && wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
{
return RiaEclipseUnitTools::feetToMeter( m_diameter() );
@@ -177,8 +176,7 @@ cvf::BoundingBox RimPerforationInterval::boundingBoxInDomainCoords() const
{
cvf::BoundingBox bb;
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPath = firstAncestorOrThisOfTypeAsserted<RimWellPath>();
RigWellPath* rigWellPath = wellPath->wellPathGeometry();
if ( rigWellPath )
@@ -195,8 +193,7 @@ cvf::BoundingBox RimPerforationInterval::boundingBoxInDomainCoords() const
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::setUnitSystemSpecificDefaults()
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( wellPath )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
@@ -236,9 +233,7 @@ std::vector<RimWellPathValve*> RimPerforationInterval::valves() const
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::updateAllReferringTracks()
{
std::vector<RimWellLogTrack*> wellLogTracks;
this->objectsWithReferringPtrFieldsOfType( wellLogTracks );
std::vector<RimWellLogTrack*> wellLogTracks = objectsWithReferringPtrFieldsOfType<RimWellLogTrack>();
for ( RimWellLogTrack* track : wellLogTracks )
{
track->loadDataAndUpdate();
@@ -251,8 +246,7 @@ void RimPerforationInterval::updateAllReferringTracks()
//--------------------------------------------------------------------------------------------------
bool RimPerforationInterval::isEnabled() const
{
RimPerforationCollection* perforationCollection;
this->firstAncestorOrThisOfTypeAsserted( perforationCollection );
auto perforationCollection = firstAncestorOrThisOfTypeAsserted<RimPerforationCollection>();
return perforationCollection->isChecked() && isChecked();
}
@@ -328,8 +322,7 @@ void RimPerforationInterval::fieldChangedByUi( const caf::PdmFieldHandle* change
this->updateAllReferringTracks();
RimProject* proj = nullptr;
this->firstAncestorOrThisOfTypeAsserted( proj );
RimProject* proj = RimProject::current();
proj->reloadCompletionTypeResultsInAllViews();
}
@@ -347,8 +340,7 @@ void RimPerforationInterval::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTre
void RimPerforationInterval::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( wellPath )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
@@ -401,8 +393,7 @@ void RimPerforationInterval::defineEditorAttribute( const caf::PdmFieldHandle* f
if ( myAttr )
{
RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfType( wellPath );
auto wellPath = firstAncestorOrThisOfType<RimWellPath>();
if ( !wellPath ) return;
myAttr->m_minimum = wellPath->uniqueStartMD();