#950 Fixed formation name changes updating for geomech views

This commit is contained in:
Jacob Støren 2016-11-04 15:10:58 +01:00
parent 6d1d6ba1af
commit daa8bae0f1
4 changed files with 68 additions and 3 deletions

View File

@ -35,6 +35,10 @@
#include "RimTools.h"
#include "RimWellLogPlotCollection.h"
#include "RimFormationNames.h"
#include "RimGeoMechPropertyFilterCollection.h"
#include "RimGeoMechCellColors.h"
#include "RimGeoMechResultDefinition.h"
#include "RimGeoMechPropertyFilter.h"
#include <QFile>
@ -122,7 +126,14 @@ bool RimGeoMechCase::openGeoMechCase(std::string* errorMessage)
}
else
{
this->updateFormationNamesData();
if ( activeFormationNames() )
{
m_geoMechCaseData->femPartResults()->setActiveFormationNames(activeFormationNames()->formationNamesData());
}
else
{
m_geoMechCaseData->femPartResults()->setActiveFormationNames(nullptr);
}
}
return fileOpenSuccess;
}
@ -299,8 +310,41 @@ void RimGeoMechCase::updateFormationNamesData()
std::vector<RimView*> views = this->views();
for(RimView* view : views)
{
if(view && view->isUsingFormationNames())
RimGeoMechView* geomView = dynamic_cast<RimGeoMechView*>(view);
if ( geomView && geomView->isUsingFormationNames() )
{
if ( !activeFormationNames() )
{
if ( geomView->cellResult()->resultPositionType() == RIG_FORMATION_NAMES )
{
geomView->cellResult()->setResultAddress(RigFemResultAddress(RIG_FORMATION_NAMES, "", ""));
geomView->cellResult()->updateConnectedEditors();
}
RimGeoMechPropertyFilterCollection* eclFilColl = geomView->geoMechPropertyFilterCollection();
for ( RimGeoMechPropertyFilter* propFilter : eclFilColl->propertyFilters )
{
if ( propFilter->resultDefinition()->resultPositionType() == RIG_FORMATION_NAMES )
{
propFilter->resultDefinition()->setResultAddress(RigFemResultAddress(RIG_FORMATION_NAMES, "", ""));
}
}
}
RimGeoMechPropertyFilterCollection* eclFilColl = geomView->geoMechPropertyFilterCollection();
for ( RimGeoMechPropertyFilter* propFilter : eclFilColl->propertyFilters )
{
if ( propFilter->resultDefinition->resultPositionType() == RIG_FORMATION_NAMES )
{
propFilter->setToDefaultValues();
propFilter->updateConnectedEditors();
}
}
geomView->cellResult()->updateConnectedEditors();
view->scheduleGeometryRegen(PROPERTY_FILTERED);
view->scheduleCreateDisplayModelAndRedraw();
}
}

View File

@ -118,6 +118,24 @@ bool RimGeoMechPropertyFilterCollection::hasActiveDynamicFilters() const
return hasActiveFilters();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGeoMechPropertyFilterCollection::isUsingFormationNames() const
{
if ( !isActive ) return false;
for ( size_t i = 0; i < propertyFilters.size(); i++ )
{
RimGeoMechPropertyFilter* propertyFilter = propertyFilters[i];
if ( propertyFilter->isActive()
&& propertyFilter->resultDefinition->resultPositionType() == RIG_FORMATION_NAMES
&& propertyFilter->resultDefinition->resultFieldName() != "") return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -47,6 +47,7 @@ public:
// Methods
bool hasActiveFilters() const;
bool hasActiveDynamicFilters() const;
bool isUsingFormationNames() const;
void loadAndInitializePropertyFilters();
void updateIconState();

View File

@ -672,7 +672,9 @@ void RimGeoMechView::axisLabels(cvf::String* xLabel, cvf::String* yLabel, cvf::S
//--------------------------------------------------------------------------------------------------
bool RimGeoMechView::isUsingFormationNames() const
{
return cellResult()->hasCategoryResult(); // Correct for now
if (cellResult()->hasCategoryResult()) return true; // Correct for now
return geoMechPropertyFilterCollection()->isUsingFormationNames();
}
//--------------------------------------------------------------------------------------------------