#5019 Support separate intersection results for 2Dintersection views

This commit is contained in:
Jacob Støren
2019-11-25 11:40:57 +01:00
parent 1ab815e673
commit 9bfe51b205
2 changed files with 156 additions and 84 deletions

View File

@@ -319,14 +319,24 @@ void RivIntersectionPartMgr::createFaultLabelParts( const std::vector<std::pair<
if ( !labelAndAnchors.size() ) return;
RimEclipseView* eclipseView = nullptr;
m_rimCrossSection->firstAncestorOrThisOfType( eclipseView );
RimFaultInViewCollection* faultInViewColl = eclipseView->faultCollection();
RimFaultInViewCollection* faultInViewColl = nullptr;
if ( !( eclipseView && faultInViewColl->showFaultLabel() ) ) return;
if ( !m_rimCrossSection->activeSeparateResultDefinition() )
{
RimEclipseView* eclipseView = nullptr;
m_rimCrossSection->firstAncestorOrThisOfType( eclipseView );
if ( eclipseView )
{
faultInViewColl = eclipseView->faultCollection();
cvf::Color3f faultLabelColor = faultInViewColl->faultLabelColor();
cvf::Font* font = RiaGuiApplication::instance()->defaultSceneFont();
if ( faultInViewColl && !faultInViewColl->showFaultLabel() ) return;
}
}
cvf::Color3f faultLabelColor = RiaApplication::instance()->preferences()->defaultWellLabelColor();
if ( faultInViewColl ) faultLabelColor = faultInViewColl->faultLabelColor();
cvf::Font* font = RiaGuiApplication::instance()->defaultSceneFont();
std::vector<cvf::Vec3f> lineVertices;
@@ -346,9 +356,11 @@ void RivIntersectionPartMgr::createFaultLabelParts( const std::vector<std::pair<
for ( const auto& labelAndAnchorPair : labelAndAnchors )
{
RimFaultInView* fault = faultInViewColl->findFaultByName( labelAndAnchorPair.first );
if ( !( fault && fault->showFault() ) ) continue;
if ( faultInViewColl )
{
RimFaultInView* fault = faultInViewColl->findFaultByName( labelAndAnchorPair.first );
if ( !( fault && fault->showFault() ) ) continue;
}
cvf::String cvfString = cvfqt::Utils::toString( labelAndAnchorPair.first );
cvf::Vec3f textCoord( labelAndAnchorPair.second );

View File

@@ -20,6 +20,7 @@
#include "Rim3dOverlayInfoConfig.h"
#include "RimCase.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
#include "RimGeoMechCellColors.h"
@@ -163,7 +164,14 @@ void Rim2dIntersectionView::scheduleGeometryRegen( RivCellSetEnum geometryType )
RimCase* Rim2dIntersectionView::ownerCase() const
{
RimCase* rimCase = nullptr;
this->firstAncestorOrThisOfTypeAsserted( rimCase );
if ( RimIntersectionResultDefinition* sepInterResultDef = m_intersection->activeSeparateResultDefinition() )
{
rimCase = sepInterResultDef->activeCase();
}
else
{
this->firstAncestorOrThisOfTypeAsserted( rimCase );
}
return rimCase;
}
@@ -174,9 +182,18 @@ bool Rim2dIntersectionView::isTimeStepDependentDataVisible() const
{
if ( m_intersection() )
{
RimGridView* gridView = nullptr;
m_intersection->firstAncestorOrThisOfTypeAsserted( gridView );
return gridView->isTimeStepDependentDataVisibleInThisOrComparisonView();
if ( RimIntersectionResultDefinition* sepInterResultDef = m_intersection->activeSeparateResultDefinition() )
{
return sepInterResultDef->isEclipseResultDefinition()
? sepInterResultDef->eclipseResultDefinition()->hasDynamicResult()
: sepInterResultDef->geoMechResultDefinition()->hasResult();
}
else
{
RimGridView* gridView = nullptr;
m_intersection->firstAncestorOrThisOfTypeAsserted( gridView );
return gridView->isTimeStepDependentDataVisibleInThisOrComparisonView();
}
}
return false;
@@ -191,9 +208,29 @@ void Rim2dIntersectionView::update3dInfo()
QString overlayInfoText;
RimEclipseView* eclView = nullptr;
m_intersection->firstAncestorOrThisOfType( eclView );
if ( eclView && !eclView->overlayInfoConfig()->isActive() )
Rim3dOverlayInfoConfig* overlayInfoConfig = nullptr;
RimGeoMechResultDefinition* geomResDef = nullptr;
RimEclipseResultDefinition* eclResDef = nullptr;
{
RimEclipseView* originEclView = nullptr;
m_intersection->firstAncestorOrThisOfType( originEclView );
RimGeoMechView* originGeoView = nullptr;
m_intersection->firstAncestorOrThisOfType( originGeoView );
if ( originEclView )
{
overlayInfoConfig = originEclView->overlayInfoConfig();
eclResDef = originEclView->cellResult();
}
else if ( originGeoView )
{
overlayInfoConfig = originGeoView->overlayInfoConfig();
geomResDef = originGeoView->cellResultResultDefinition();
}
}
if ( !overlayInfoConfig->isActive() )
{
nativeOrOverrideViewer()->showInfoText( false );
nativeOrOverrideViewer()->showHistogram( false );
@@ -203,20 +240,27 @@ void Rim2dIntersectionView::update3dInfo()
nativeOrOverrideViewer()->update();
return;
}
if ( eclView && eclView->overlayInfoConfig()->showCaseInfo() )
if ( RimIntersectionResultDefinition* sepInterResultDef = m_intersection->activeSeparateResultDefinition() )
{
overlayInfoText += "<b>--" + ownerCase()->caseUserDescription() + "--</b>";
if ( sepInterResultDef->isEclipseResultDefinition() )
{
eclResDef = sepInterResultDef->eclipseResultDefinition();
geomResDef = nullptr;
}
else
{
geomResDef = sepInterResultDef->geoMechResultDefinition();
eclResDef = nullptr;
}
}
RimGeoMechView* geoView = nullptr;
m_intersection->firstAncestorOrThisOfType( geoView );
if ( geoView && geoView->overlayInfoConfig()->showCaseInfo() )
if ( overlayInfoConfig->showCaseInfo() )
{
overlayInfoText += "<b>--" + ownerCase()->caseUserDescription() + "--</b>";
}
overlayInfoText += "<p>";
overlayInfoText += "<b>Z-scale:</b> " + QString::number( scaleZ() ) + "<br> ";
if ( m_intersection->simulationWell() )
@@ -232,41 +276,28 @@ void Rim2dIntersectionView::update3dInfo()
overlayInfoText += "<b>Intersection:</b> " + m_intersection->name() + "<br>";
}
if ( eclView )
if ( overlayInfoConfig->showAnimProgress() )
{
if ( eclView->overlayInfoConfig()->showAnimProgress() )
{
nativeOrOverrideViewer()->showAnimationProgress( true );
}
else
{
nativeOrOverrideViewer()->showAnimationProgress( false );
}
if ( eclView->overlayInfoConfig()->showResultInfo() )
{
overlayInfoText += "<b>Cell Result:</b> " + eclView->cellResult()->resultVariableUiShortName() + "<br>";
}
nativeOrOverrideViewer()->showAnimationProgress( true );
}
else
{
nativeOrOverrideViewer()->showAnimationProgress( false );
}
if ( geoView )
if ( overlayInfoConfig->showResultInfo() )
{
if ( geoView->overlayInfoConfig()->showAnimProgress() )
if ( eclResDef )
{
nativeOrOverrideViewer()->showAnimationProgress( true );
overlayInfoText += "<b>Cell Result:</b> " + eclResDef->resultVariableUiShortName() + "<br>";
}
else
{
nativeOrOverrideViewer()->showAnimationProgress( false );
}
if ( geoView->overlayInfoConfig()->showResultInfo() )
else if ( geomResDef )
{
QString resultPos;
QString fieldName = geoView->cellResultResultDefinition()->resultFieldUiName();
QString compName = geoView->cellResultResultDefinition()->resultComponentUiName();
QString fieldName = geomResDef->resultFieldUiName();
QString compName = geomResDef->resultComponentUiName();
switch ( geoView->cellResultResultDefinition()->resultPositionType() )
switch ( geomResDef->resultPositionType() )
{
case RIG_NODAL:
resultPos = "Nodal";
@@ -286,6 +317,7 @@ void Rim2dIntersectionView::update3dInfo()
default:
break;
}
if ( compName == "" )
{
overlayInfoText += QString( "<b>Cell result:</b> %1, %2<br>" ).arg( resultPos ).arg( fieldName );
@@ -406,6 +438,20 @@ bool Rim2dIntersectionView::hasResults()
{
if ( !m_intersection() ) return false;
if ( RimIntersectionResultDefinition* sepInterResultDef = m_intersection->activeSeparateResultDefinition() )
{
if ( sepInterResultDef->isEclipseResultDefinition() )
{
RimEclipseResultDefinition* eclResDef = sepInterResultDef->eclipseResultDefinition();
return eclResDef->hasResult() || eclResDef->isTernarySaturationSelected();
}
else
{
RimGeoMechResultDefinition* geomResDef = sepInterResultDef->geoMechResultDefinition();
return geomResDef->hasResult();
}
}
RimEclipseView* eclView = nullptr;
m_intersection->firstAncestorOrThisOfType( eclView );
if ( eclView )
@@ -510,7 +556,7 @@ void Rim2dIntersectionView::onCreateDisplayModel()
RimEclipseView* eclipseView = nullptr;
m_intersection->firstAncestorOrThisOfType( eclipseView );
if ( eclipseView )
// if ( eclipseView ) Do we need this ?
{
m_flatSimWellPipePartMgr = new RivSimWellPipesPartMgr( m_intersection->simulationWell() );
m_flatWellHeadPartMgr = new RivWellHeadPartMgr( m_intersection->simulationWell() );
@@ -635,66 +681,80 @@ void Rim2dIntersectionView::onUpdateLegends()
if ( !hasResults() ) return;
RimEclipseView* eclView = nullptr;
m_intersection->firstAncestorOrThisOfType( eclView );
RimGeoMechResultDefinition* geomResDef = nullptr;
RimEclipseResultDefinition* eclResDef = nullptr;
RimRegularLegendConfig* regularLegendConfig = nullptr;
RimTernaryLegendConfig* ternaryLegendConfig = nullptr;
RimGeoMechView* geoView = nullptr;
m_intersection->firstAncestorOrThisOfType( geoView );
caf::TitledOverlayFrame* legend = nullptr;
if ( eclView )
{
// Copy the legend settings from the real view
RimEclipseView* originEclView = nullptr;
m_intersection->firstAncestorOrThisOfType( originEclView );
RimGeoMechView* originGeoView = nullptr;
m_intersection->firstAncestorOrThisOfType( originGeoView );
RimIntersectionResultDefinition* sepInterResDef = m_intersection->activeSeparateResultDefinition();
if ( sepInterResDef )
if ( originEclView )
{
m_legendConfig()->setUiValuesFromLegendConfig( sepInterResDef->regularLegendConfig() );
m_ternaryLegendConfig()->setUiValuesFromLegendConfig( sepInterResDef->ternaryLegendConfig() );
eclResDef = originEclView->cellResult();
regularLegendConfig = originEclView->cellResult()->legendConfig();
ternaryLegendConfig = originEclView->cellResult()->ternaryLegendConfig();
}
else if ( originGeoView )
{
geomResDef = originGeoView->cellResultResultDefinition();
regularLegendConfig = originGeoView->cellResult()->legendConfig();
}
}
if ( RimIntersectionResultDefinition* sepInterResultDef = m_intersection->activeSeparateResultDefinition() )
{
if ( sepInterResultDef->isEclipseResultDefinition() )
{
eclResDef = sepInterResultDef->eclipseResultDefinition();
regularLegendConfig = sepInterResultDef->regularLegendConfig();
ternaryLegendConfig = sepInterResultDef->ternaryLegendConfig();
geomResDef = nullptr;
}
else
{
m_legendConfig()->setUiValuesFromLegendConfig( eclView->cellResult()->legendConfig() );
m_ternaryLegendConfig()->setUiValuesFromLegendConfig( eclView->cellResult()->ternaryLegendConfig() );
geomResDef = sepInterResultDef->geoMechResultDefinition();
regularLegendConfig = sepInterResultDef->regularLegendConfig();
eclResDef = nullptr;
}
}
eclView->cellResult()->updateRangesForExplicitLegends( m_legendConfig(),
m_ternaryLegendConfig(),
m_currentTimeStep() );
caf::TitledOverlayFrame* legend = nullptr;
if ( eclView->cellResult()->isTernarySaturationSelected() )
// Copy the legend settings from the real view
m_legendConfig()->setUiValuesFromLegendConfig( regularLegendConfig );
if ( ternaryLegendConfig ) m_ternaryLegendConfig()->setUiValuesFromLegendConfig( ternaryLegendConfig );
if ( eclResDef )
{
eclResDef->updateRangesForExplicitLegends( m_legendConfig(), m_ternaryLegendConfig(), m_currentTimeStep() );
if ( eclResDef->isTernarySaturationSelected() )
{
m_ternaryLegendConfig()->setTitle( "Cell Result:\n" );
legend = m_ternaryLegendConfig()->titledOverlayFrame();
m_legendObjectToSelect = eclView->cellResult()->ternaryLegendConfig();
m_legendObjectToSelect = ternaryLegendConfig;
}
else
{
eclView->cellResult()->updateLegendTitle( m_legendConfig, "Cell Result:\n" );
eclResDef->updateLegendTitle( m_legendConfig, "Cell Result:\n" );
legend = m_legendConfig()->titledOverlayFrame();
m_legendObjectToSelect = eclView->cellResult()->legendConfig();
m_legendObjectToSelect = regularLegendConfig;
}
}
if ( geoView )
if ( geomResDef )
{
RimIntersectionResultDefinition* sepInterResDef = m_intersection->activeSeparateResultDefinition();
if ( sepInterResDef )
{
m_legendConfig()->setUiValuesFromLegendConfig( sepInterResDef->regularLegendConfig() );
}
else
{
m_legendConfig()->setUiValuesFromLegendConfig( geoView->cellResult()->legendConfig() );
}
geoView->updateLegendTextAndRanges( m_legendConfig(), m_currentTimeStep() );
geomResDef->updateLegendTextAndRanges( m_legendConfig(), "Cell Result:\n", m_currentTimeStep() );
legend = m_legendConfig()->titledOverlayFrame();
m_legendObjectToSelect = geoView->cellResult()->legendConfig();
m_legendObjectToSelect = regularLegendConfig;
}
if ( legend )