#5119, #5120 Default case for intersection result

Fixed missing intersection colors when cellresults are turned off
This commit is contained in:
Jacob Støren
2019-11-29 09:29:17 +01:00
parent fa72835dd8
commit 021af085a7
10 changed files with 87 additions and 40 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

@@ -32,6 +32,7 @@
#include "RivBoxIntersectionPartMgr.h"
#include "RivExtrudedCurveIntersectionPartMgr.h"
#include "RimIntersectionResultDefinition.h"
#include "cvfModelBasicList.h"
CAF_PDM_SOURCE_INIT( RimIntersectionCollection, "CrossSectionCollection" );
@@ -97,24 +98,42 @@ void RimIntersectionCollection::applySingleColorEffect()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionCollection::updateCellResultColor( size_t timeStepIndex )
void RimIntersectionCollection::updateCellResultColor( bool hasGeneralCellResult, size_t timeStepIndex )
{
if ( !this->isActive() ) return;
for ( RimExtrudedCurveIntersection* cs : m_intersections )
{
if ( cs->isActive() )
{
bool hasSeparateInterResult = cs->activeSeparateResultDefinition() &&
cs->activeSeparateResultDefinition()->hasResult();
if ( hasSeparateInterResult || hasGeneralCellResult )
{
cs->intersectionPartMgr()->updateCellResultColor( timeStepIndex, nullptr, nullptr );
}
else
{
cs->intersectionPartMgr()->applySingleColorEffect();
}
}
}
for ( RimBoxIntersection* cs : m_intersectionBoxes )
{
if ( cs->isActive() )
{
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();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

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