mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-24 07:16:53 -06:00
(#497) Moved per cell filter code from property filter to result definition
This commit is contained in:
parent
b85e254983
commit
e8079783cb
@ -109,32 +109,6 @@ void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Property filter can handle only one value per cell. Remove option items that has more than
|
||||
/// one value per cell
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilter::removePerCellFaceOptionItems(QList<caf::PdmOptionItemInfo>& optionItems)
|
||||
{
|
||||
std::vector<int> indicesToRemove;
|
||||
for (int i = 0; i < optionItems.size(); i++)
|
||||
{
|
||||
QString text = optionItems[i].optionUiText;
|
||||
|
||||
if (RimDefines::isPerCellFaceResult(text))
|
||||
{
|
||||
indicesToRemove.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(indicesToRemove.begin(), indicesToRemove.end());
|
||||
|
||||
std::vector<int>::reverse_iterator rit;
|
||||
for (rit = indicesToRemove.rbegin(); rit != indicesToRemove.rend(); ++rit)
|
||||
{
|
||||
optionItems.takeAt(*rit);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -57,8 +57,6 @@ public:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void initAfterRead();
|
||||
|
||||
void removePerCellFaceOptionItems(QList<caf::PdmOptionItemInfo>& optionItems);
|
||||
|
||||
protected:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) ;
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||
|
@ -198,10 +198,13 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> optionItems = calculateValueOptionsForSpecifiedDerivedListPosition(false, fieldNeedingOptions, useOptionsOnly);
|
||||
|
||||
RimWellLogPlotCurve* curve = NULL;
|
||||
this->firstAnchestorOrThisOfType(curve);
|
||||
|
||||
RimEclipsePropertyFilter* propFilter = dynamic_cast<RimEclipsePropertyFilter*>(this->parentField()->ownerObject());
|
||||
if (propFilter)
|
||||
if (propFilter || curve)
|
||||
{
|
||||
propFilter->removePerCellFaceOptionItems(optionItems);
|
||||
removePerCellFaceOptionItems(optionItems);
|
||||
}
|
||||
|
||||
return optionItems;
|
||||
@ -431,3 +434,28 @@ void RimEclipseResultDefinition::updateFieldVisibility()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultDefinition::removePerCellFaceOptionItems(QList<caf::PdmOptionItemInfo>& optionItems)
|
||||
{
|
||||
std::vector<int> indicesToRemove;
|
||||
for (int i = 0; i < optionItems.size(); i++)
|
||||
{
|
||||
QString text = optionItems[i].optionUiText;
|
||||
|
||||
if (RimDefines::isPerCellFaceResult(text))
|
||||
{
|
||||
indicesToRemove.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(indicesToRemove.begin(), indicesToRemove.end());
|
||||
|
||||
std::vector<int>::reverse_iterator rit;
|
||||
for (rit = indicesToRemove.rbegin(); rit != indicesToRemove.rend(); ++rit)
|
||||
{
|
||||
optionItems.takeAt(*rit);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,10 @@ protected:
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptionsForSpecifiedDerivedListPosition(bool showDerivedResultsFirstInList, const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
QStringList getResultVariableListForCurrentUIFieldSettings();
|
||||
static void removePerCellFaceOptionItems(QList<caf::PdmOptionItemInfo>& optionItems);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user