mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -2,17 +2,17 @@
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -20,8 +20,8 @@
|
||||
#include "RimGeoMechPropertyFilter.h"
|
||||
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigFormationNames.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
|
||||
#include "RimGeoMechPropertyFilterCollection.h"
|
||||
#include "RimGeoMechResultDefinition.h"
|
||||
@@ -35,29 +35,29 @@
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfMath.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimGeoMechPropertyFilter, "GeoMechPropertyFilter");
|
||||
CAF_PDM_SOURCE_INIT( RimGeoMechPropertyFilter, "GeoMechPropertyFilter" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechPropertyFilter::RimGeoMechPropertyFilter()
|
||||
: m_parentContainer(nullptr)
|
||||
: m_parentContainer( nullptr )
|
||||
{
|
||||
CAF_PDM_InitObject("Property Filter", ":/CellFilter_Values.png", "", "");
|
||||
CAF_PDM_InitObject( "Property Filter", ":/CellFilter_Values.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&resultDefinition, "ResultDefinition", "Result Definition", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault( &resultDefinition, "ResultDefinition", "Result Definition", "", "", "" );
|
||||
resultDefinition = new RimGeoMechResultDefinition();
|
||||
|
||||
// Set to hidden to avoid this item to been displayed as a child item
|
||||
// Fields in this object are displayed using defineUiOrdering()
|
||||
resultDefinition.uiCapability()->setUiHidden(true);
|
||||
resultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
resultDefinition.uiCapability()->setUiHidden( true );
|
||||
resultDefinition.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
CAF_PDM_InitField(&lowerBound, "LowerBound", 0.0, "Min", "", "", "");
|
||||
lowerBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
CAF_PDM_InitField( &lowerBound, "LowerBound", 0.0, "Min", "", "", "" );
|
||||
lowerBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField(&upperBound, "UpperBound", 0.0, "Max", "", "", "");
|
||||
upperBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
CAF_PDM_InitField( &upperBound, "UpperBound", 0.0, "Max", "", "", "" );
|
||||
upperBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
|
||||
updateIconState();
|
||||
|
||||
@@ -66,7 +66,7 @@ RimGeoMechPropertyFilter::RimGeoMechPropertyFilter()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechPropertyFilter::~RimGeoMechPropertyFilter()
|
||||
{
|
||||
@@ -74,34 +74,33 @@ RimGeoMechPropertyFilter::~RimGeoMechPropertyFilter()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
void RimGeoMechPropertyFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( &lowerBound == changedField
|
||||
|| &upperBound == changedField
|
||||
|| &isActive == changedField
|
||||
|| &filterMode == changedField
|
||||
|| &m_selectedCategoryValues == changedField)
|
||||
if ( &lowerBound == changedField || &upperBound == changedField || &isActive == changedField ||
|
||||
&filterMode == changedField || &m_selectedCategoryValues == changedField )
|
||||
{
|
||||
this->updateIconState();
|
||||
this->updateFilterName();
|
||||
this->uiCapability()->updateConnectedEditors();
|
||||
|
||||
parentContainer()->updateDisplayModelNotifyManagedViews(this);
|
||||
parentContainer()->updateDisplayModelNotifyManagedViews( this );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::setParentContainer(RimGeoMechPropertyFilterCollection* parentContainer)
|
||||
void RimGeoMechPropertyFilter::setParentContainer( RimGeoMechPropertyFilterCollection* parentContainer )
|
||||
{
|
||||
m_parentContainer = parentContainer;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechPropertyFilterCollection* RimGeoMechPropertyFilter::parentContainer()
|
||||
{
|
||||
@@ -109,11 +108,11 @@ RimGeoMechPropertyFilterCollection* RimGeoMechPropertyFilter::parentContainer()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::setToDefaultValues()
|
||||
{
|
||||
CVF_ASSERT(m_parentContainer);
|
||||
CVF_ASSERT( m_parentContainer );
|
||||
|
||||
computeResultValueRange();
|
||||
|
||||
@@ -126,123 +125,124 @@ void RimGeoMechPropertyFilter::setToDefaultValues()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
void RimGeoMechPropertyFilter::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add(&name);
|
||||
uiOrdering.add( &name );
|
||||
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
|
||||
resultDefinition->uiOrdering(uiConfigName, *group1);
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup( "Result" );
|
||||
resultDefinition->uiOrdering( uiConfigName, *group1 );
|
||||
|
||||
caf::PdmUiGroup& group2 = *(uiOrdering.addNewGroup("Filter Settings"));
|
||||
caf::PdmUiGroup& group2 = *( uiOrdering.addNewGroup( "Filter Settings" ) );
|
||||
|
||||
group2.add(&filterMode);
|
||||
group2.add( &filterMode );
|
||||
|
||||
if ( resultDefinition->hasCategoryResult() )
|
||||
{
|
||||
group2.add(&m_selectedCategoryValues);
|
||||
group2.add( &m_selectedCategoryValues );
|
||||
}
|
||||
else
|
||||
{
|
||||
group2.add(&lowerBound);
|
||||
group2.add(&upperBound);
|
||||
group2.add( &lowerBound );
|
||||
group2.add( &upperBound );
|
||||
}
|
||||
|
||||
updateReadOnlyStateOfAllFields();
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName)
|
||||
void RimGeoMechPropertyFilter::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
|
||||
{
|
||||
PdmObject::defineUiTreeOrdering(uiTreeOrdering, uiConfigName);
|
||||
PdmObject::defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
|
||||
|
||||
updateActiveState();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::updateReadOnlyStateOfAllFields()
|
||||
{
|
||||
bool readOnlyState = isPropertyFilterControlled();
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> objFields;
|
||||
this->fields(objFields);
|
||||
this->fields( objFields );
|
||||
|
||||
// Include fields declared in RimResultDefinition
|
||||
objFields.push_back(&(resultDefinition->m_resultPositionTypeUiField));
|
||||
objFields.push_back(&(resultDefinition->m_resultVariableUiField));
|
||||
objFields.push_back(&(resultDefinition->m_timeLapseBaseTimestep));
|
||||
objFields.push_back( &( resultDefinition->m_resultPositionTypeUiField ) );
|
||||
objFields.push_back( &( resultDefinition->m_resultVariableUiField ) );
|
||||
objFields.push_back( &( resultDefinition->m_timeLapseBaseTimestep ) );
|
||||
|
||||
for (size_t i = 0; i < objFields.size(); i++)
|
||||
for ( size_t i = 0; i < objFields.size(); i++ )
|
||||
{
|
||||
objFields[i]->uiCapability()->setUiReadOnly(readOnlyState);
|
||||
objFields[i]->uiCapability()->setUiReadOnly( readOnlyState );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGeoMechPropertyFilter::isPropertyFilterControlled()
|
||||
{
|
||||
bool isPropertyFilterControlled = false;
|
||||
|
||||
Rim3dView* rimView = nullptr;
|
||||
firstAncestorOrThisOfType(rimView);
|
||||
CVF_ASSERT(rimView);
|
||||
if (rimView)
|
||||
firstAncestorOrThisOfType( rimView );
|
||||
CVF_ASSERT( rimView );
|
||||
if ( rimView )
|
||||
{
|
||||
RimViewController* vc = rimView->viewController();
|
||||
if (vc && vc->isPropertyFilterOveridden())
|
||||
if ( vc && vc->isPropertyFilterOveridden() )
|
||||
{
|
||||
isPropertyFilterControlled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return isPropertyFilterControlled;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::updateActiveState()
|
||||
{
|
||||
isActive.uiCapability()->setUiReadOnly(isPropertyFilterControlled());
|
||||
isActive.uiCapability()->setUiReadOnly( isPropertyFilterControlled() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGeoMechPropertyFilter::isActiveAndHasResult()
|
||||
{
|
||||
if (this->isActive() && this->resultDefinition->hasResult())
|
||||
if ( this->isActive() && this->resultDefinition->hasResult() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
void RimGeoMechPropertyFilter::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if (m_minimumResultValue == cvf::UNDEFINED_DOUBLE || m_maximumResultValue == cvf::UNDEFINED_DOUBLE)
|
||||
if ( m_minimumResultValue == cvf::UNDEFINED_DOUBLE || m_maximumResultValue == cvf::UNDEFINED_DOUBLE )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (field == &lowerBound || field == &upperBound)
|
||||
if ( field == &lowerBound || field == &upperBound )
|
||||
{
|
||||
caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>(attribute);
|
||||
if (!myAttr)
|
||||
caf::PdmUiDoubleSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute );
|
||||
if ( !myAttr )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -253,11 +253,11 @@ void RimGeoMechPropertyFilter::defineEditorAttribute(const caf::PdmFieldHandle*
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::computeResultValueRange()
|
||||
{
|
||||
CVF_ASSERT(m_parentContainer);
|
||||
CVF_ASSERT( m_parentContainer );
|
||||
|
||||
double min = 0.0;
|
||||
double max = 0.0;
|
||||
@@ -265,39 +265,39 @@ void RimGeoMechPropertyFilter::computeResultValueRange()
|
||||
clearCategories();
|
||||
|
||||
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
|
||||
if (resultAddress.isValid() && resultDefinition->ownerCaseData())
|
||||
if ( resultAddress.isValid() && resultDefinition->ownerCaseData() )
|
||||
{
|
||||
if (resultDefinition->hasCategoryResult())
|
||||
if ( resultDefinition->hasCategoryResult() )
|
||||
{
|
||||
std::vector<QString> fnVector;
|
||||
if (resultDefinition->ownerCaseData()->femPartResults()->activeFormationNames())
|
||||
if ( resultDefinition->ownerCaseData()->femPartResults()->activeFormationNames() )
|
||||
{
|
||||
fnVector = resultDefinition->ownerCaseData()->femPartResults()->activeFormationNames()->formationNames();
|
||||
}
|
||||
setCategoryNames(fnVector);
|
||||
setCategoryNames( fnVector );
|
||||
}
|
||||
else
|
||||
{
|
||||
resultDefinition->ownerCaseData()->femPartResults()->minMaxScalarValues(resultAddress, &min, &max);
|
||||
resultDefinition->ownerCaseData()->femPartResults()->minMaxScalarValues( resultAddress, &min, &max );
|
||||
}
|
||||
}
|
||||
|
||||
m_maximumResultValue = max;
|
||||
m_minimumResultValue = min;
|
||||
|
||||
lowerBound.uiCapability()->setUiName(QString("Min (%1)").arg(min));
|
||||
upperBound.uiCapability()->setUiName(QString("Max (%1)").arg(max));
|
||||
lowerBound.uiCapability()->setUiName( QString( "Min (%1)" ).arg( min ) );
|
||||
upperBound.uiCapability()->setUiName( QString( "Max (%1)" ).arg( max ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilter::updateFilterName()
|
||||
{
|
||||
RigFemResultAddress resultAddress = resultDefinition->resultAddress();
|
||||
QString newFiltername;
|
||||
QString newFiltername;
|
||||
|
||||
if (resultAddress.resultPosType == RIG_FORMATION_NAMES)
|
||||
if ( resultAddress.resultPosType == RIG_FORMATION_NAMES )
|
||||
{
|
||||
newFiltername = resultDefinition->resultFieldName();
|
||||
}
|
||||
@@ -305,23 +305,30 @@ void RimGeoMechPropertyFilter::updateFilterName()
|
||||
{
|
||||
QString posName;
|
||||
|
||||
switch (resultAddress.resultPosType)
|
||||
switch ( resultAddress.resultPosType )
|
||||
{
|
||||
case RIG_NODAL: posName = "N"; break;
|
||||
case RIG_ELEMENT_NODAL: posName = "EN"; break;
|
||||
case RIG_INTEGRATION_POINT: posName = "IP"; break;
|
||||
case RIG_ELEMENT: posName = "E"; break;
|
||||
case RIG_NODAL:
|
||||
posName = "N";
|
||||
break;
|
||||
case RIG_ELEMENT_NODAL:
|
||||
posName = "EN";
|
||||
break;
|
||||
case RIG_INTEGRATION_POINT:
|
||||
posName = "IP";
|
||||
break;
|
||||
case RIG_ELEMENT:
|
||||
posName = "E";
|
||||
break;
|
||||
}
|
||||
|
||||
QString fieldUiName = resultDefinition->resultFieldUiName();
|
||||
QString compoUiName = resultDefinition->resultComponentUiName();
|
||||
|
||||
newFiltername = posName + ", " + fieldUiName + ", " + compoUiName + " ("
|
||||
+ QString::number(lowerBound()) + " .. " + QString::number(upperBound) + ")";
|
||||
newFiltername = posName + ", " + fieldUiName + ", " + compoUiName + " (" + QString::number( lowerBound() ) +
|
||||
" .. " + QString::number( upperBound ) + ")";
|
||||
}
|
||||
|
||||
this->name = newFiltername;
|
||||
|
||||
uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user