mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1297 Use firstAncestorOrThisOfTypeAsserted, comments and whitespace
This commit is contained in:
parent
7f1d88e487
commit
6bcc385da5
@ -112,11 +112,11 @@ void RicEclipsePropertyFilterFeatureImpl::setDefaults(RimEclipsePropertyFilter*
|
|||||||
{
|
{
|
||||||
CVF_ASSERT(propertyFilter);
|
CVF_ASSERT(propertyFilter);
|
||||||
|
|
||||||
RimEclipsePropertyFilterCollection* propertyFilterCollection = propertyFilter->parentContainer();
|
RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr;
|
||||||
CVF_ASSERT(propertyFilterCollection);
|
propertyFilter->firstAncestorOrThisOfTypeAsserted(propertyFilterCollection);
|
||||||
|
|
||||||
RimEclipseView* reservoirView = propertyFilterCollection->reservoirView();
|
RimEclipseView* reservoirView = nullptr;
|
||||||
CVF_ASSERT(reservoirView);
|
propertyFilter->firstAncestorOrThisOfTypeAsserted(reservoirView);
|
||||||
|
|
||||||
propertyFilter->resultDefinition->setEclipseCase(reservoirView->eclipseCase());
|
propertyFilter->resultDefinition->setEclipseCase(reservoirView->eclipseCase());
|
||||||
propertyFilter->resultDefinition->simpleCopy(reservoirView->cellResult);
|
propertyFilter->resultDefinition->simpleCopy(reservoirView->cellResult);
|
||||||
|
@ -57,8 +57,8 @@ QString RicEclipsePropertyFilterInsertExec::name()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicEclipsePropertyFilterInsertExec::redo()
|
void RicEclipsePropertyFilterInsertExec::redo()
|
||||||
{
|
{
|
||||||
RimEclipsePropertyFilterCollection* propertyFilterCollection = m_propertyFilter->parentContainer();
|
RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr;
|
||||||
CVF_ASSERT(propertyFilterCollection);
|
m_propertyFilter->firstAncestorOrThisOfTypeAsserted(propertyFilterCollection);
|
||||||
|
|
||||||
size_t index = propertyFilterCollection->propertyFilters.index(m_propertyFilter);
|
size_t index = propertyFilterCollection->propertyFilters.index(m_propertyFilter);
|
||||||
CVF_ASSERT(index < propertyFilterCollection->propertyFilters.size());
|
CVF_ASSERT(index < propertyFilterCollection->propertyFilters.size());
|
||||||
|
@ -131,7 +131,6 @@ bool RimEclipsePropertyFilter::isCategorySelectionActive() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( &m_lowerBound == changedField
|
if ( &m_lowerBound == changedField
|
||||||
|| &m_upperBound == changedField
|
|| &m_upperBound == changedField
|
||||||
|| &obsoleteField_evaluationRegion == changedField
|
|| &obsoleteField_evaluationRegion == changedField
|
||||||
@ -153,7 +152,10 @@ void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimEclipsePropertyFilterCollection* RimEclipsePropertyFilter::parentContainer()
|
RimEclipsePropertyFilterCollection* RimEclipsePropertyFilter::parentContainer()
|
||||||
{
|
{
|
||||||
return dynamic_cast<RimEclipsePropertyFilterCollection*>(this->parentField()->ownerObject());
|
RimEclipsePropertyFilterCollection* propFilterColl = nullptr;
|
||||||
|
this->firstAncestorOrThisOfTypeAsserted(propFilterColl);
|
||||||
|
|
||||||
|
return propFilterColl;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -170,7 +172,6 @@ void RimEclipsePropertyFilter::setToDefaultValues()
|
|||||||
|
|
||||||
m_selectedCategoryValues = m_categoryValues;
|
m_selectedCategoryValues = m_categoryValues;
|
||||||
m_useCategorySelection = true;
|
m_useCategorySelection = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -265,18 +266,14 @@ void RimEclipsePropertyFilter::updateRangeLabel()
|
|||||||
bool RimEclipsePropertyFilter::isPropertyFilterControlled()
|
bool RimEclipsePropertyFilter::isPropertyFilterControlled()
|
||||||
{
|
{
|
||||||
RimView* rimView = nullptr;
|
RimView* rimView = nullptr;
|
||||||
firstAncestorOrThisOfType(rimView);
|
firstAncestorOrThisOfTypeAsserted(rimView);
|
||||||
CVF_ASSERT(rimView);
|
|
||||||
|
|
||||||
bool isPropertyFilterControlled = false;
|
bool isPropertyFilterControlled = false;
|
||||||
|
|
||||||
if (rimView)
|
RimViewController* vc = rimView->viewController();
|
||||||
|
if (vc && vc->isPropertyFilterOveridden())
|
||||||
{
|
{
|
||||||
RimViewController* vc = rimView->viewController();
|
isPropertyFilterControlled = true;
|
||||||
if (vc && vc->isPropertyFilterOveridden())
|
|
||||||
{
|
|
||||||
isPropertyFilterControlled = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return isPropertyFilterControlled;
|
return isPropertyFilterControlled;
|
||||||
@ -384,6 +381,13 @@ void RimEclipsePropertyFilter::computeResultValueRange()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimEclipsePropertyFilter::updateFromCurrentTimeStep()
|
void RimEclipsePropertyFilter::updateFromCurrentTimeStep()
|
||||||
{
|
{
|
||||||
|
// Update range for flow diagnostics values when time step changes
|
||||||
|
// Range for flow is always current time step, not computed across all time steps
|
||||||
|
// If upper/lower slider is set to available extrema, the filter values will be
|
||||||
|
// updated with the min/max values for the current time step
|
||||||
|
//
|
||||||
|
// If the user manually has set a filter value, this value is left untouched
|
||||||
|
|
||||||
if (resultDefinition->resultType() != RimDefines::FLOW_DIAGNOSTICS)
|
if (resultDefinition->resultType() != RimDefines::FLOW_DIAGNOSTICS)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -509,4 +513,3 @@ void RimEclipsePropertyFilter::initAfterRead()
|
|||||||
resultDefinition->setEclipseCase(parentContainer()->reservoirView()->eclipseCase());
|
resultDefinition->setEclipseCase(parentContainer()->reservoirView()->eclipseCase());
|
||||||
updateIconState();
|
updateIconState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ public:
|
|||||||
void rangeValues(double* lower, double* upper) const;
|
void rangeValues(double* lower, double* upper) const;
|
||||||
bool isCategorySelectionActive() const;
|
bool isCategorySelectionActive() const;
|
||||||
|
|
||||||
RimEclipsePropertyFilterCollection* parentContainer();
|
|
||||||
void setToDefaultValues();
|
void setToDefaultValues();
|
||||||
void updateFilterName();
|
void updateFilterName();
|
||||||
void computeResultValueRange();
|
void computeResultValueRange();
|
||||||
@ -73,6 +72,8 @@ private:
|
|||||||
void updateRangeLabel();
|
void updateRangeLabel();
|
||||||
bool isPropertyFilterControlled();
|
bool isPropertyFilterControlled();
|
||||||
|
|
||||||
|
RimEclipsePropertyFilterCollection* parentContainer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<QString> m_rangeLabelText;
|
caf::PdmField<QString> m_rangeLabelText;
|
||||||
caf::PdmField<double> m_lowerBound;
|
caf::PdmField<double> m_lowerBound;
|
||||||
|
Loading…
Reference in New Issue
Block a user