(#497) Moved per cell filter code from property filter to result definition

This commit is contained in:
Magne Sjaastad 2015-09-21 11:43:22 +02:00
parent b85e254983
commit e8079783cb
4 changed files with 33 additions and 30 deletions

View File

@ -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);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);
};