mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#837 GeoMech: Added formation property filter. Moved some functionality to RimCellFilter
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
@@ -77,10 +78,11 @@ RimGeoMechPropertyFilter::~RimGeoMechPropertyFilter()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if ( &lowerBound == changedField
|
||||
if ( &lowerBound == changedField
|
||||
|| &upperBound == changedField
|
||||
|| &isActive == changedField
|
||||
|| &filterMode == changedField)
|
||||
|| &filterMode == changedField
|
||||
|| &m_selectedCategoryValues == changedField)
|
||||
{
|
||||
this->updateIconState();
|
||||
this->updateFilterName();
|
||||
@@ -117,6 +119,10 @@ void RimGeoMechPropertyFilter::setToDefaultValues()
|
||||
|
||||
lowerBound = m_minimumResultValue;
|
||||
upperBound = m_maximumResultValue;
|
||||
|
||||
m_selectedCategoryValues = m_categoryValues;
|
||||
|
||||
this->updateFieldVisibility();
|
||||
this->updateFilterName();
|
||||
}
|
||||
|
||||
@@ -137,6 +143,8 @@ void RimGeoMechPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
uiOrdering.add(&lowerBound);
|
||||
uiOrdering.add(&upperBound);
|
||||
|
||||
uiOrdering.add(&m_selectedCategoryValues);
|
||||
|
||||
updateReadOnlyStateOfAllFields();
|
||||
}
|
||||
|
||||
@@ -189,6 +197,25 @@ bool RimGeoMechPropertyFilter::isPropertyFilterControlled()
|
||||
return isPropertyFilterControlled;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::updateFieldVisibility()
|
||||
{
|
||||
if (resultDefinition->hasCategoryResult())
|
||||
{
|
||||
m_selectedCategoryValues.uiCapability()->setUiHidden(false);
|
||||
lowerBound.uiCapability()->setUiHidden(true);
|
||||
upperBound.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_selectedCategoryValues.uiCapability()->setUiHidden(true);
|
||||
lowerBound.uiCapability()->setUiHidden(false);
|
||||
upperBound.uiCapability()->setUiHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -230,10 +257,20 @@ void RimGeoMechPropertyFilter::computeResultValueRange()
|
||||
double min = 0.0;
|
||||
double max = 0.0;
|
||||
|
||||
clearCategories();
|
||||
|
||||
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
|
||||
if (resultAddress.isValid() && resultDefinition->ownerCaseData())
|
||||
{
|
||||
resultDefinition->ownerCaseData()->femPartResults()->minMaxScalarValues(resultAddress, &min, &max);
|
||||
if (resultDefinition->hasCategoryResult())
|
||||
{
|
||||
const std::vector<QString>& fnVector = resultDefinition->ownerCaseData()->femPartResults()->activeFormationNames()->formationNames();
|
||||
setCategoryNames(fnVector);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultDefinition->ownerCaseData()->femPartResults()->minMaxScalarValues(resultAddress, &min, &max);
|
||||
}
|
||||
}
|
||||
|
||||
m_maximumResultValue = max;
|
||||
@@ -250,21 +287,29 @@ void RimGeoMechPropertyFilter::updateFilterName()
|
||||
{
|
||||
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
|
||||
QString newFiltername;
|
||||
QString posName;
|
||||
|
||||
switch (resultAddress.resultPosType)
|
||||
if (resultAddress.resultPosType == RIG_FORMATION_NAMES)
|
||||
{
|
||||
case RIG_NODAL: posName = "N"; break;
|
||||
case RIG_ELEMENT_NODAL: posName = "EN"; break;
|
||||
case RIG_INTEGRATION_POINT: posName = "IP"; break;
|
||||
newFiltername = "Formation Names";
|
||||
}
|
||||
else
|
||||
{
|
||||
QString posName;
|
||||
|
||||
switch (resultAddress.resultPosType)
|
||||
{
|
||||
case RIG_NODAL: posName = "N"; break;
|
||||
case RIG_ELEMENT_NODAL: posName = "EN"; break;
|
||||
case RIG_INTEGRATION_POINT: posName = "IP"; break;
|
||||
}
|
||||
|
||||
QString fieldUiName = resultDefinition->resultFieldUiName();
|
||||
QString compoUiName = resultDefinition->resultComponentUiName();
|
||||
|
||||
newFiltername = posName + ", " + fieldUiName + ", " + compoUiName + " ("
|
||||
+ QString::number(lowerBound()) + " .. " + QString::number(upperBound) + ")";
|
||||
}
|
||||
|
||||
QString fieldUiName = resultDefinition->resultFieldUiName();
|
||||
QString compoUiName = resultDefinition->resultComponentUiName();
|
||||
|
||||
|
||||
newFiltername = posName + ", " + fieldUiName + ", " + compoUiName + " ("
|
||||
+ QString::number(lowerBound()) + " .. " + QString::number(upperBound) + ")";
|
||||
this->name = newFiltername;
|
||||
|
||||
uiCapability()->updateConnectedEditors();
|
||||
|
||||
Reference in New Issue
Block a user