mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
firstAnchestorOfType now considers the object itself as well.
It is thus renamed to firstAnchestorOrThisOfType
This commit is contained in:
parent
1719a10954
commit
f5d15c19e1
@ -99,7 +99,7 @@ RimIdenticalGridCaseGroup* RicPasteFeatureImpl::findGridCaseGroup(PdmObjectHandl
|
|||||||
dynamic_cast<RimEclipseCase*>(objectHandle))
|
dynamic_cast<RimEclipseCase*>(objectHandle))
|
||||||
{
|
{
|
||||||
RimIdenticalGridCaseGroup* gridCaseGroup = NULL;
|
RimIdenticalGridCaseGroup* gridCaseGroup = NULL;
|
||||||
objectHandle->firstAncestorOfType(gridCaseGroup);
|
objectHandle->firstAnchestorOrThisOfType(gridCaseGroup);
|
||||||
|
|
||||||
return gridCaseGroup;
|
return gridCaseGroup;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ RimCellRangeFilterCollection* RicRangeFilterHelper::findRangeFilterCollection()
|
|||||||
}
|
}
|
||||||
else if (selectedRangeFilter.size() > 0)
|
else if (selectedRangeFilter.size() > 0)
|
||||||
{
|
{
|
||||||
selectedRangeFilter[0]->firstAncestorOfType(rangeFilterCollection);
|
selectedRangeFilter[0]->firstAnchestorOrThisOfType(rangeFilterCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(rangeFilterCollection);
|
assert(rangeFilterCollection);
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
caf::PdmObjectHandle* objHandle = uiFieldHandle->fieldHandle()->ownerObject();
|
caf::PdmObjectHandle* objHandle = uiFieldHandle->fieldHandle()->ownerObject();
|
||||||
|
|
||||||
RimView* view = NULL;
|
RimView* view = NULL;
|
||||||
objHandle->firstAncestorOfType(view);
|
objHandle->firstAnchestorOrThisOfType(view);
|
||||||
CVF_ASSERT(view);
|
CVF_ASSERT(view);
|
||||||
|
|
||||||
view->scheduleGeometryRegen(RANGE_FILTERED);
|
view->scheduleGeometryRegen(RANGE_FILTERED);
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
caf::PdmObjectHandle* objHandle = uiFieldHandle->fieldHandle()->ownerObject();
|
caf::PdmObjectHandle* objHandle = uiFieldHandle->fieldHandle()->ownerObject();
|
||||||
|
|
||||||
RimEclipseView* view = NULL;
|
RimEclipseView* view = NULL;
|
||||||
objHandle->firstAncestorOfType(view);
|
objHandle->firstAnchestorOrThisOfType(view);
|
||||||
CVF_ASSERT(view);
|
CVF_ASSERT(view);
|
||||||
|
|
||||||
view->scheduleGeometryRegen(PROPERTY_FILTERED);
|
view->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||||
@ -115,7 +115,7 @@ void RimEclipsePropertyFilterCollection::fieldChangedByUi(const caf::PdmFieldHan
|
|||||||
this->updateUiIconFromToggleField();
|
this->updateUiIconFromToggleField();
|
||||||
|
|
||||||
RimEclipseView* view = NULL;
|
RimEclipseView* view = NULL;
|
||||||
this->firstAncestorOfType(view);
|
this->firstAnchestorOrThisOfType(view);
|
||||||
CVF_ASSERT(view);
|
CVF_ASSERT(view);
|
||||||
|
|
||||||
view->scheduleGeometryRegen(PROPERTY_FILTERED);
|
view->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||||
|
@ -70,7 +70,7 @@ void RimFault::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const Q
|
|||||||
{
|
{
|
||||||
RimEclipseView* reservoirView = NULL;
|
RimEclipseView* reservoirView = NULL;
|
||||||
|
|
||||||
this->firstAncestorOfType(reservoirView);
|
this->firstAnchestorOrThisOfType(reservoirView);
|
||||||
|
|
||||||
if (reservoirView)
|
if (reservoirView)
|
||||||
{
|
{
|
||||||
|
@ -1528,7 +1528,7 @@ double RimReservoirCellResultsStorage::darchysValue()
|
|||||||
double darchy = 0.008527; // (ECLIPSE 100) (METRIC)
|
double darchy = 0.008527; // (ECLIPSE 100) (METRIC)
|
||||||
|
|
||||||
RimEclipseCase* rimCase = NULL;
|
RimEclipseCase* rimCase = NULL;
|
||||||
this->firstAncestorOfType(rimCase);
|
this->firstAnchestorOrThisOfType(rimCase);
|
||||||
|
|
||||||
if (rimCase && rimCase->reservoirData())
|
if (rimCase && rimCase->reservoirData())
|
||||||
{
|
{
|
||||||
|
@ -1636,7 +1636,7 @@ void RiuMainWindow::selectedObjectsChanged()
|
|||||||
RimView* selectedReservoirView = dynamic_cast<RimView*>(firstSelectedObject);
|
RimView* selectedReservoirView = dynamic_cast<RimView*>(firstSelectedObject);
|
||||||
if (!selectedReservoirView && firstSelectedObject)
|
if (!selectedReservoirView && firstSelectedObject)
|
||||||
{
|
{
|
||||||
firstSelectedObject->firstAncestorOfType(selectedReservoirView);
|
firstSelectedObject->firstAnchestorOrThisOfType(selectedReservoirView);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If current selection is an item within a different reservoir view than active,
|
// If current selection is an item within a different reservoir view than active,
|
||||||
|
@ -32,7 +32,7 @@ public:
|
|||||||
PdmFieldHandle* parentField() const;
|
PdmFieldHandle* parentField() const;
|
||||||
/// Convenience function. Traverses from parent to parents parent to find first object of the requested type.
|
/// Convenience function. Traverses from parent to parents parent to find first object of the requested type.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void firstAncestorOfType(T*& ancestor) const;
|
void firstAnchestorOrThisOfType(T*& ancestor) const;
|
||||||
|
|
||||||
// PtrReferences
|
// PtrReferences
|
||||||
/// The PdmPtrField's containing pointers to this PdmObjecthandle
|
/// The PdmPtrField's containing pointers to this PdmObjecthandle
|
||||||
@ -101,8 +101,19 @@ namespace caf
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void PdmObjectHandle::firstAncestorOfType(T*& ancestor) const
|
void PdmObjectHandle::firstAnchestorOrThisOfType(T*& ancestor) const
|
||||||
{
|
{
|
||||||
|
// Check if this matches the type
|
||||||
|
|
||||||
|
const T* objectOfType = dynamic_cast<const T*>(this);
|
||||||
|
if (objectOfType)
|
||||||
|
{
|
||||||
|
ancestor = const_cast<T*>(objectOfType);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search anchestors
|
||||||
|
|
||||||
PdmObjectHandle* parent = NULL;
|
PdmObjectHandle* parent = NULL;
|
||||||
PdmFieldHandle* parentField = this->parentField();
|
PdmFieldHandle* parentField = this->parentField();
|
||||||
if (parentField) parent = parentField->ownerObject();
|
if (parentField) parent = parentField->ownerObject();
|
||||||
|
Loading…
Reference in New Issue
Block a user