Merge pull request #5130 from OPM/feature-polish-separate-intersection-results

Polish separate intersection results
This commit is contained in:
Jacob Støren 2019-11-29 11:21:12 +01:00 committed by GitHub
commit d736419fd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 111 additions and 42 deletions

View File

@ -102,15 +102,6 @@ void RicAppendSeparateIntersectionResultFeatureCmd::redo()
m_intersectionCollection->appendIntersectionResultDefinition( intersectionResDef );
m_intersectionCollection->updateConnectedEditors();
// if ( m_intersectionCollection->intersectionResultsDefinitions().size() < 2 ) // New default created. Possible
//{
// RimGridView* gridView;
// m_intersectionCollection->firstAncestorOrThisOfTypeAsserted( gridView );
//
// gridView->scheduleCreateDisplayModelAndRedraw();
// gridView->crossSectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
//}
}
//--------------------------------------------------------------------------------------------------

View File

@ -172,11 +172,8 @@ void RivIntersectionResultsColoringTools::updateEclipseCellResultColors(
cvf::ref<RigResultAccessor> resultAccessor;
if ( RiaDefines::isPerCellFaceResult( eclipseResDef->resultVariable() ) )
{
resultAccessor = new RigHugeValResultAccessor;
}
else
if ( !RiaDefines::isPerCellFaceResult( eclipseResDef->resultVariable() ) )
{
resultAccessor = RigResultAccessorFactory::createFromResultDefinition( eclipseCaseData,
0,
@ -184,6 +181,11 @@ void RivIntersectionResultsColoringTools::updateEclipseCellResultColors(
eclipseResDef );
}
if ( resultAccessor.isNull() )
{
resultAccessor = new RigHugeValResultAccessor;
}
RivIntersectionResultsColoringTools::calculateEclipseTextureCoordinates( intersectionFacesTextureCoords,
triangleToCellIndexMapping,
resultAccessor.p(),

View File

@ -792,15 +792,10 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors()
this->updateFaultColors();
if ( ( this->hasUserRequestedAnimation() && this->cellResult()->hasResult() ) ||
this->cellResult()->isTernarySaturationSelected() )
{
m_intersectionCollection->updateCellResultColor( m_currentTimeStep );
}
else
{
m_intersectionCollection->applySingleColorEffect();
}
m_intersectionCollection->updateCellResultColor( ( this->hasUserRequestedAnimation() &&
this->cellResult()->hasResult() ) ||
this->cellResult()->isTernarySaturationSelected(),
m_currentTimeStep );
}
//--------------------------------------------------------------------------------------------------

View File

@ -383,19 +383,13 @@ void RimGeoMechView::onUpdateDisplayModelForCurrentTimeStep()
else
m_vizLogic->updateStaticCellColors( m_currentTimeStep() );
if ( this->cellResult()->hasResult() )
{
m_intersectionCollection->updateCellResultColor( m_currentTimeStep );
}
else
{
m_intersectionCollection->applySingleColorEffect();
}
m_intersectionCollection->updateCellResultColor( this->cellResult()->hasResult(), m_currentTimeStep );
}
else
{
m_vizLogic->updateStaticCellColors( -1 );
m_intersectionCollection->applySingleColorEffect();
m_intersectionCollection->updateCellResultColor( false, m_currentTimeStep );
nativeOrOverrideViewer()->animationControl()->slotPause(); // To avoid animation timer spinning in the background
}

View File

@ -171,7 +171,8 @@ void RimIntersection::defineSeparateDataSourceUi( QString uiConfigName, caf::Pdm
inactiveText = " (Inactive)";
}
caf::PdmUiGroup* separateResultsGroup = uiOrdering.addNewGroup( "Separate Result Reference" + inactiveText );
caf::PdmUiGroup* separateResultsGroup = uiOrdering.addNewGroupWithKeyword( "Separate Result Reference" + inactiveText,
"SeparateResultReference" );
separateResultsGroup->setCollapsedByDefault( true );
separateResultsGroup->add( &m_useSeparateDataSource );
separateResultsGroup->add( &m_separateDataSource );

View File

@ -32,6 +32,7 @@
#include "RivBoxIntersectionPartMgr.h"
#include "RivExtrudedCurveIntersectionPartMgr.h"
#include "RimIntersectionResultDefinition.h"
#include "cvfModelBasicList.h"
CAF_PDM_SOURCE_INIT( RimIntersectionCollection, "CrossSectionCollection" );
@ -97,7 +98,7 @@ void RimIntersectionCollection::applySingleColorEffect()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::updateCellResultColor( size_t timeStepIndex )
void RimIntersectionCollection::updateCellResultColor( bool hasGeneralCellResult, size_t timeStepIndex )
{
if ( !this->isActive() ) return;
@ -105,7 +106,16 @@ void RimIntersectionCollection::updateCellResultColor( size_t timeStepIndex )
{
if ( cs->isActive() )
{
cs->intersectionPartMgr()->updateCellResultColor( timeStepIndex, nullptr, nullptr );
bool hasSeparateInterResult = cs->activeSeparateResultDefinition() &&
cs->activeSeparateResultDefinition()->hasResult();
if ( hasSeparateInterResult || hasGeneralCellResult )
{
cs->intersectionPartMgr()->updateCellResultColor( timeStepIndex, nullptr, nullptr );
}
else
{
cs->intersectionPartMgr()->applySingleColorEffect();
}
}
}
@ -113,7 +123,16 @@ void RimIntersectionCollection::updateCellResultColor( size_t timeStepIndex )
{
if ( cs->isActive() )
{
cs->intersectionBoxPartMgr()->updateCellResultColor( timeStepIndex );
bool hasSeparateInterResult = cs->activeSeparateResultDefinition() &&
cs->activeSeparateResultDefinition()->hasResult();
if ( hasSeparateInterResult || hasGeneralCellResult )
{
cs->intersectionBoxPartMgr()->updateCellResultColor( timeStepIndex );
}
else
{
cs->intersectionBoxPartMgr()->applySingleColorEffect();
}
}
}
}

View File

@ -69,7 +69,7 @@ public:
// Visualization interface
void applySingleColorEffect();
void updateCellResultColor( size_t timeStepIndex );
void updateCellResultColor( bool hasGeneralCellResult, size_t timeStepIndex );
void appendPartsToModel( Rim3dView& view, cvf::ModelBasicList* model, cvf::Transform* scaleTransform );
void rebuildGeometry();

View File

@ -98,6 +98,13 @@ QString RimIntersectionResultDefinition::autoName() const
QString timestepName;
QString caseName = "Default undefined source";
if ( !m_case )
{
RimCase* ownerCase = nullptr;
this->firstAncestorOrThisOfType( ownerCase );
const_cast<RimIntersectionResultDefinition*>( this )->setActiveCase( ownerCase );
}
if ( m_case )
{
QStringList timestepNames = m_case->timeStepStrings();
@ -133,6 +140,19 @@ RimCase* RimIntersectionResultDefinition::activeCase() const
return m_case();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionResultDefinition::setActiveCase( RimCase* activeCase )
{
m_case = activeCase;
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
m_geomResultDefinition->setGeoMechCase( geomCase );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
m_eclipseResultDefinition->setEclipseCase( eclipseCase );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -141,6 +161,21 @@ int RimIntersectionResultDefinition::timeStep() const
return m_timeStep();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimIntersectionResultDefinition::hasResult()
{
if ( isEclipseResultDefinition() )
{
return m_eclipseResultDefinition->hasResult() || m_eclipseResultDefinition->isTernarySaturationSelected();
}
else
{
return m_geomResultDefinition->hasResult();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -196,6 +231,25 @@ void RimIntersectionResultDefinition::updateLegendRangesTextAndVisibility( RiuVi
{
if ( !this->isInAction() ) return;
if ( ( this->isEclipseResultDefinition() && m_eclipseResultDefinition()->hasCategoryResult() ) ||
( !this->isEclipseResultDefinition() && m_geomResultDefinition()->hasCategoryResult() ) )
{
regularLegendConfig()->setMappingMode( RimRegularLegendConfig::CATEGORY_INTEGER );
regularLegendConfig()->setColorRange( RimRegularLegendConfig::CATEGORY );
}
else
{
if ( regularLegendConfig()->mappingMode() == RimRegularLegendConfig::CATEGORY_INTEGER )
{
regularLegendConfig()->setMappingMode( RimRegularLegendConfig::LINEAR_CONTINUOUS );
}
if ( regularLegendConfig()->colorRange() == RimRegularLegendConfig::CATEGORY )
{
regularLegendConfig()->setColorRange( RimRegularLegendConfig::NORMAL );
}
}
if ( this->isEclipseResultDefinition() )
{
RimEclipseResultDefinition* eclResultDef = this->eclipseResultDefinition();
@ -349,7 +403,9 @@ void RimIntersectionResultDefinition::defineUiOrdering( QString uiConfigName, ca
m_geomResultDefinition->uiOrdering( uiConfigName, uiOrdering );
}
if ( ( eclipseCase && m_eclipseResultDefinition->hasDynamicResult() ) || geomCase )
if ( ( eclipseCase && m_eclipseResultDefinition->hasDynamicResult() ||
m_eclipseResultDefinition->isTernarySaturationSelected() ) ||
geomCase )
{
uiOrdering.add( &m_timeStep );
}

View File

@ -43,8 +43,10 @@ public:
bool isInAction() const;
QString autoName() const;
RimCase* activeCase() const;
void setActiveCase( RimCase* activeCase );
bool isEclipseResultDefinition();
int timeStep() const;
bool hasResult();
RimRegularLegendConfig* regularLegendConfig() const;
RimTernaryLegendConfig* ternaryLegendConfig() const;

View File

@ -18,6 +18,7 @@
#include "RimIntersectionResultsDefinitionCollection.h"
#include "RimCase.h"
#include "RimGridView.h"
#include "RimIntersectionCollection.h"
#include "RimIntersectionResultDefinition.h"
@ -48,7 +49,7 @@ RimIntersectionResultsDefinitionCollection::~RimIntersectionResultsDefinitionCol
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimIntersectionResultsDefinitionCollection::isActive()
bool RimIntersectionResultsDefinitionCollection::isActive() const
{
return m_isActive();
}
@ -56,7 +57,8 @@ bool RimIntersectionResultsDefinitionCollection::isActive()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimIntersectionResultDefinition*> RimIntersectionResultsDefinitionCollection::intersectionResultsDefinitions()
std::vector<RimIntersectionResultDefinition*>
RimIntersectionResultsDefinitionCollection::intersectionResultsDefinitions() const
{
return m_intersectionResultsDefs.childObjects();
}
@ -68,6 +70,13 @@ void RimIntersectionResultsDefinitionCollection::appendIntersectionResultDefinit
RimIntersectionResultDefinition* interResDef )
{
m_intersectionResultsDefs.push_back( interResDef );
if ( interResDef->activeCase() == nullptr )
{
RimCase* ownerCase = nullptr;
this->firstAncestorOrThisOfType( ownerCase );
interResDef->setActiveCase( ownerCase );
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -32,9 +32,9 @@ public:
RimIntersectionResultsDefinitionCollection();
~RimIntersectionResultsDefinitionCollection() override;
bool isActive();
bool isActive() const;
std::vector<RimIntersectionResultDefinition*> intersectionResultsDefinitions();
std::vector<RimIntersectionResultDefinition*> intersectionResultsDefinitions() const;
void appendIntersectionResultDefinition( RimIntersectionResultDefinition* interResDef );