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->appendIntersectionResultDefinition( intersectionResDef );
m_intersectionCollection->updateConnectedEditors(); 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; cvf::ref<RigResultAccessor> resultAccessor;
if ( RiaDefines::isPerCellFaceResult( eclipseResDef->resultVariable() ) ) if ( !RiaDefines::isPerCellFaceResult( eclipseResDef->resultVariable() ) )
{
resultAccessor = new RigHugeValResultAccessor;
}
else
{ {
resultAccessor = RigResultAccessorFactory::createFromResultDefinition( eclipseCaseData, resultAccessor = RigResultAccessorFactory::createFromResultDefinition( eclipseCaseData,
0, 0,
@ -184,6 +181,11 @@ void RivIntersectionResultsColoringTools::updateEclipseCellResultColors(
eclipseResDef ); eclipseResDef );
} }
if ( resultAccessor.isNull() )
{
resultAccessor = new RigHugeValResultAccessor;
}
RivIntersectionResultsColoringTools::calculateEclipseTextureCoordinates( intersectionFacesTextureCoords, RivIntersectionResultsColoringTools::calculateEclipseTextureCoordinates( intersectionFacesTextureCoords,
triangleToCellIndexMapping, triangleToCellIndexMapping,
resultAccessor.p(), resultAccessor.p(),

View File

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

View File

@ -383,19 +383,13 @@ void RimGeoMechView::onUpdateDisplayModelForCurrentTimeStep()
else else
m_vizLogic->updateStaticCellColors( m_currentTimeStep() ); m_vizLogic->updateStaticCellColors( m_currentTimeStep() );
if ( this->cellResult()->hasResult() ) m_intersectionCollection->updateCellResultColor( this->cellResult()->hasResult(), m_currentTimeStep );
{
m_intersectionCollection->updateCellResultColor( m_currentTimeStep );
}
else
{
m_intersectionCollection->applySingleColorEffect();
}
} }
else else
{ {
m_vizLogic->updateStaticCellColors( -1 ); m_vizLogic->updateStaticCellColors( -1 );
m_intersectionCollection->applySingleColorEffect();
m_intersectionCollection->updateCellResultColor( false, m_currentTimeStep );
nativeOrOverrideViewer()->animationControl()->slotPause(); // To avoid animation timer spinning in the background 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)"; 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->setCollapsedByDefault( true );
separateResultsGroup->add( &m_useSeparateDataSource ); separateResultsGroup->add( &m_useSeparateDataSource );
separateResultsGroup->add( &m_separateDataSource ); separateResultsGroup->add( &m_separateDataSource );

View File

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

View File

@ -69,7 +69,7 @@ public:
// Visualization interface // Visualization interface
void applySingleColorEffect(); 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 appendPartsToModel( Rim3dView& view, cvf::ModelBasicList* model, cvf::Transform* scaleTransform );
void rebuildGeometry(); void rebuildGeometry();

View File

@ -98,6 +98,13 @@ QString RimIntersectionResultDefinition::autoName() const
QString timestepName; QString timestepName;
QString caseName = "Default undefined source"; QString caseName = "Default undefined source";
if ( !m_case )
{
RimCase* ownerCase = nullptr;
this->firstAncestorOrThisOfType( ownerCase );
const_cast<RimIntersectionResultDefinition*>( this )->setActiveCase( ownerCase );
}
if ( m_case ) if ( m_case )
{ {
QStringList timestepNames = m_case->timeStepStrings(); QStringList timestepNames = m_case->timeStepStrings();
@ -133,6 +140,19 @@ RimCase* RimIntersectionResultDefinition::activeCase() const
return m_case(); 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(); 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->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() ) if ( this->isEclipseResultDefinition() )
{ {
RimEclipseResultDefinition* eclResultDef = this->eclipseResultDefinition(); RimEclipseResultDefinition* eclResultDef = this->eclipseResultDefinition();
@ -349,7 +403,9 @@ void RimIntersectionResultDefinition::defineUiOrdering( QString uiConfigName, ca
m_geomResultDefinition->uiOrdering( uiConfigName, uiOrdering ); m_geomResultDefinition->uiOrdering( uiConfigName, uiOrdering );
} }
if ( ( eclipseCase && m_eclipseResultDefinition->hasDynamicResult() ) || geomCase ) if ( ( eclipseCase && m_eclipseResultDefinition->hasDynamicResult() ||
m_eclipseResultDefinition->isTernarySaturationSelected() ) ||
geomCase )
{ {
uiOrdering.add( &m_timeStep ); uiOrdering.add( &m_timeStep );
} }

View File

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

View File

@ -18,6 +18,7 @@
#include "RimIntersectionResultsDefinitionCollection.h" #include "RimIntersectionResultsDefinitionCollection.h"
#include "RimCase.h"
#include "RimGridView.h" #include "RimGridView.h"
#include "RimIntersectionCollection.h" #include "RimIntersectionCollection.h"
#include "RimIntersectionResultDefinition.h" #include "RimIntersectionResultDefinition.h"
@ -48,7 +49,7 @@ RimIntersectionResultsDefinitionCollection::~RimIntersectionResultsDefinitionCol
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimIntersectionResultsDefinitionCollection::isActive() bool RimIntersectionResultsDefinitionCollection::isActive() const
{ {
return m_isActive(); 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(); return m_intersectionResultsDefs.childObjects();
} }
@ -68,6 +70,13 @@ void RimIntersectionResultsDefinitionCollection::appendIntersectionResultDefinit
RimIntersectionResultDefinition* interResDef ) RimIntersectionResultDefinition* interResDef )
{ {
m_intersectionResultsDefs.push_back( 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();
~RimIntersectionResultsDefinitionCollection() override; ~RimIntersectionResultsDefinitionCollection() override;
bool isActive(); bool isActive() const;
std::vector<RimIntersectionResultDefinition*> intersectionResultsDefinitions(); std::vector<RimIntersectionResultDefinition*> intersectionResultsDefinitions() const;
void appendIntersectionResultDefinition( RimIntersectionResultDefinition* interResDef ); void appendIntersectionResultDefinition( RimIntersectionResultDefinition* interResDef );