(#119) Improved naming of Property Filters

Finalized.
This commit is contained in:
Jacob Støren 2015-07-02 12:49:28 +02:00
parent bfdc00edaf
commit 1a3a2f1ff5
8 changed files with 60 additions and 6 deletions

View File

@ -28,6 +28,7 @@
#include "cafPdmUiDoubleSliderEditor.h"
#include "cvfAssert.h"
#include "cvfMath.h"
#include "RiuMainWindow.h"
namespace caf
@ -110,6 +111,7 @@ void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* chang
resultDefinition->fieldChangedByUi(changedField, oldValue, newValue);
setToDefaultValues();
m_parentContainer->fieldChangedByUi(changedField, oldValue, newValue);
updateFilterName();
}
if ( &lowerBound == changedField
@ -119,6 +121,7 @@ void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* chang
|| &filterMode == changedField)
{
m_parentContainer->fieldChangedByUi(changedField, oldValue, newValue);
updateFilterName();
this->updateIconState();
}
}
@ -255,3 +258,15 @@ void RimEclipsePropertyFilter::computeResultValueRange()
upperBound.setUiName(QString("Max (%1)").arg(max));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilter::updateFilterName()
{
QString newFiltername;
newFiltername = resultDefinition->resultVariable() + " ("
+ QString::number(lowerBound()) + " .. " + QString::number(upperBound) + ")";
this->name = newFiltername;
RiuMainWindow::instance()->forceProjectTreeRepaint();
}

View File

@ -50,6 +50,7 @@ public:
void setParentContainer(RimEclipsePropertyFilterCollection* parentContainer);
RimEclipsePropertyFilterCollection* parentContainer();
void setToDefaultValues();
void updateFilterName();
void computeResultValueRange();
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
@ -59,6 +60,7 @@ protected:
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
private:
RimEclipsePropertyFilterCollection* m_parentContainer;
double m_minimumResultValue;
double m_maximumResultValue;

View File

@ -99,8 +99,7 @@ RimEclipsePropertyFilter* RimEclipsePropertyFilterCollection::createAndAppendPro
propertyFilter->resultDefinition->setResultType(m_reservoirView->cellResult->resultType());
propertyFilter->resultDefinition->loadResult();
propertyFilter->setToDefaultValues();
propertyFilter->name = m_reservoirView->cellResult->resultVariable() + QString(" (%1)").arg(propertyFilters().size());
propertyFilter->updateFilterName();
return propertyFilter;

View File

@ -28,6 +28,7 @@
#include "RigFemPartResultsCollection.h"
#include "RigGeoMechCaseData.h"
#include "RimGeoMechView.h"
#include "RiuMainWindow.h"
CAF_PDM_SOURCE_INIT(RimGeoMechPropertyFilter, "GeoMechPropertyFilter");
@ -79,6 +80,7 @@ void RimGeoMechPropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* chang
|| &filterMode == changedField)
{
this->updateIconState();
this->updateFilterName();
((RimView*)resultDefinition->reservoirView())->scheduleGeometryRegen(PROPERTY_FILTERED);
resultDefinition->reservoirView()->scheduleCreateDisplayModelAndRedraw();
}
@ -111,6 +113,7 @@ void RimGeoMechPropertyFilter::setToDefaultValues()
lowerBound = m_minimumResultValue;
upperBound = m_maximumResultValue;
this->updateFilterName();
}
//--------------------------------------------------------------------------------------------------
@ -177,3 +180,27 @@ void RimGeoMechPropertyFilter::computeResultValueRange()
lowerBound.setUiName(QString("Min (%1)").arg(min));
upperBound.setUiName(QString("Max (%1)").arg(max));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechPropertyFilter::updateFilterName()
{
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
QString newFiltername;
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;
}
newFiltername = posName + ", " + QString::fromStdString(resultAddress.fieldName + ", " + resultAddress.componentName) + " ("
+ QString::number(lowerBound()) + " .. " + QString::number(upperBound) + ")";
this->name = newFiltername;
RiuMainWindow::instance()->forceProjectTreeRepaint();
}

View File

@ -45,6 +45,7 @@ public:
void setParentContainer(RimGeoMechPropertyFilterCollection* parentContainer);
RimGeoMechPropertyFilterCollection* parentContainer();
void setToDefaultValues();
void updateFilterName();
void computeResultValueRange();
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);

View File

@ -98,9 +98,7 @@ RimGeoMechPropertyFilter* RimGeoMechPropertyFilterCollection::createAndAppendPro
propertyFilter->resultDefinition->setResultAddress(m_reservoirView->cellResult()->resultAddress());
propertyFilter->resultDefinition->loadResult();
propertyFilter->setToDefaultValues();
RigFemResultAddress resAddr = m_reservoirView->cellResult()->resultAddress();
propertyFilter->name = QString::fromStdString(resAddr.fieldName + ", " + resAddr.componentName) + QString(" (%1)").arg(propertyFilters().size());
propertyFilter->updateFilterName();
return propertyFilter;
}

View File

@ -2132,3 +2132,14 @@ void RiuMainWindow::setExpanded(const caf::PdmObject* pdmObject, bool expanded)
m_treeView->setExpanded(mi, expanded);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::forceProjectTreeRepaint()
{
// This is a hack to force the treeview redraw.
// Needed for some reason when changing names and icons in the model
m_treeView->scroll(0,1);
m_treeView->scroll(0,-1);
}

View File

@ -84,6 +84,7 @@ public:
void refreshAnimationActions();
void updateScaleValue();
void forceProjectTreeRepaint();
RimUiTreeModelPdm* uiPdmModel() { return m_treeModelPdm;}