diff --git a/ApplicationCode/ModelVisualization/Surfaces/RivSurfacePartMgr.cpp b/ApplicationCode/ModelVisualization/Surfaces/RivSurfacePartMgr.cpp index e6067a4295..89911c7b7d 100644 --- a/ApplicationCode/ModelVisualization/Surfaces/RivSurfacePartMgr.cpp +++ b/ApplicationCode/ModelVisualization/Surfaces/RivSurfacePartMgr.cpp @@ -102,7 +102,7 @@ void RivSurfacePartMgr::updateCellResultColor( size_t timeStepIndex ) if ( m_intersectionFaces.notNull() ) { RivIntersectionResultsColoringTools::calculateIntersectionResultColors( timeStepIndex, - false, + true, m_surfaceInView, m_intersectionGenerator.p(), nullptr, diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index caddeb5d93..eac1335c4e 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -1232,7 +1232,17 @@ void RimEclipseView::onUpdateLegends() for ( RimIntersectionResultDefinition* sepInterResDef : this->separateIntersectionResultsCollection()->intersectionResultsDefinitions() ) { - sepInterResDef->updateLegendRangesTextAndVisibility( nativeOrOverrideViewer(), isUsingOverrideViewer() ); + sepInterResDef->updateLegendRangesTextAndVisibility( "Intersection Results:\n", + nativeOrOverrideViewer(), + isUsingOverrideViewer() ); + } + + for ( RimIntersectionResultDefinition* sepInterResDef : + this->separateSurfaceResultsCollection()->intersectionResultsDefinitions() ) + { + sepInterResDef->updateLegendRangesTextAndVisibility( "Surface Results:\n", + nativeOrOverrideViewer(), + isUsingOverrideViewer() ); } if ( this->cellEdgeResult()->legendConfig()->showLegend() ) @@ -1843,6 +1853,16 @@ bool RimEclipseView::isTimeStepDependentDataVisible() const if ( this->faultResultSettings()->customFaultResult()->isTernarySaturationSelected() ) return true; } + if ( this->intersectionCollection()->hasAnyActiveSeparateResults() ) + { + return true; + } + + if ( this->surfaceInViewCollection()->hasAnyActiveSeparateResults() ) + { + return true; + } + if ( this->wellPathCollection() && this->wellPathCollection()->anyWellsContainingPerforationIntervals() ) return true; @@ -1884,6 +1904,13 @@ void RimEclipseView::onResetLegendsInViewer() sepInterResDef->ternaryLegendConfig()->recreateLegend(); } + for ( RimIntersectionResultDefinition* sepInterResDef : + this->separateSurfaceResultsCollection()->intersectionResultsDefinitions() ) + { + sepInterResDef->regularLegendConfig()->recreateLegend(); + sepInterResDef->ternaryLegendConfig()->recreateLegend(); + } + for ( RimWellMeasurementInView* wellMeasurement : m_wellMeasurementCollection->measurements() ) { wellMeasurement->legendConfig()->recreateLegend(); @@ -2044,6 +2071,13 @@ std::vector RimEclipseView::legendConfigs() const absLegends.push_back( sepInterResDef->ternaryLegendConfig() ); } + for ( RimIntersectionResultDefinition* sepInterResDef : + this->separateSurfaceResultsCollection()->intersectionResultsDefinitions() ) + { + absLegends.push_back( sepInterResDef->regularLegendConfig() ); + absLegends.push_back( sepInterResDef->ternaryLegendConfig() ); + } + for ( RimWellMeasurementInView* wellMeasurement : m_wellMeasurementCollection->measurements() ) { absLegends.push_back( wellMeasurement->legendConfig() ); diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp index f772797cc1..73ef1c1b74 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp @@ -321,6 +321,7 @@ void RimGeoMechView::onCreateDisplayModel() onUpdateLegends(); m_vizLogic->updateStaticCellColors( -1 ); m_intersectionCollection->applySingleColorEffect(); + m_surfaceCollection->applySingleColorEffect(); m_overlayInfoConfig()->update3DInfo(); } @@ -450,6 +451,13 @@ void RimGeoMechView::onResetLegendsInViewer() sepInterResDef->ternaryLegendConfig()->recreateLegend(); } + for ( RimIntersectionResultDefinition* sepInterResDef : + this->separateSurfaceResultsCollection()->intersectionResultsDefinitions() ) + { + sepInterResDef->regularLegendConfig()->recreateLegend(); + sepInterResDef->ternaryLegendConfig()->recreateLegend(); + } + for ( RimWellMeasurementInView* wellMeasurement : m_wellMeasurementCollection->measurements() ) { wellMeasurement->legendConfig()->recreateLegend(); @@ -490,7 +498,17 @@ void RimGeoMechView::onUpdateLegends() for ( RimIntersectionResultDefinition* sepInterResDef : this->separateIntersectionResultsCollection()->intersectionResultsDefinitions() ) { - sepInterResDef->updateLegendRangesTextAndVisibility( nativeOrOverrideViewer(), isUsingOverrideViewer() ); + sepInterResDef->updateLegendRangesTextAndVisibility( "Intersection Results:\n", + nativeOrOverrideViewer(), + isUsingOverrideViewer() ); + } + + for ( RimIntersectionResultDefinition* sepInterResDef : + this->separateSurfaceResultsCollection()->intersectionResultsDefinitions() ) + { + sepInterResDef->updateLegendRangesTextAndVisibility( "Surface Results:\n", + nativeOrOverrideViewer(), + isUsingOverrideViewer() ); } if ( tensorResults()->showTensors() ) @@ -618,6 +636,12 @@ std::vector RimGeoMechView::legendConfigs() const absLegendConfigs.push_back( sepInterResDef->regularLegendConfig() ); } + for ( RimIntersectionResultDefinition* sepInterResDef : + this->separateSurfaceResultsCollection()->intersectionResultsDefinitions() ) + { + absLegendConfigs.push_back( sepInterResDef->regularLegendConfig() ); + } + for ( RimWellMeasurementInView* wellMeasurement : m_wellMeasurementCollection->measurements() ) { absLegendConfigs.push_back( wellMeasurement->legendConfig() ); @@ -747,10 +771,22 @@ bool RimGeoMechView::isTimeStepDependentDataVisible() const { return true; } + if ( this->hasVisibleTimeStepDependent3dWellLogCurves() ) { return true; } + + if ( this->intersectionCollection()->hasAnyActiveSeparateResults() ) + { + return true; + } + + if ( this->surfaceInViewCollection()->hasAnyActiveSeparateResults() ) + { + return true; + } + if ( m_wellMeasurementCollection->isChecked() ) { return true; diff --git a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp index 2c7f409afb..5171d987ce 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp @@ -106,9 +106,10 @@ void RimIntersectionCollection::updateCellResultColor( bool hasGeneralCellResult { if ( cs->isActive() ) { - bool hasSeparateInterResult = cs->activeSeparateResultDefinition() && - cs->activeSeparateResultDefinition()->hasResult(); - if ( hasSeparateInterResult || hasGeneralCellResult ) + bool showResults = cs->activeSeparateResultDefinition() ? cs->activeSeparateResultDefinition()->hasResult() + : hasGeneralCellResult; + + if ( showResults ) { cs->intersectionPartMgr()->updateCellResultColor( timeStepIndex, nullptr, nullptr ); } @@ -137,6 +138,31 @@ void RimIntersectionCollection::updateCellResultColor( bool hasGeneralCellResult } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimIntersectionCollection::hasAnyActiveSeparateResults() +{ + if ( !this->isActive() ) return false; + + for ( RimExtrudedCurveIntersection* cs : m_intersections ) + { + if ( cs->isActive() && cs->activeSeparateResultDefinition() && cs->activeSeparateResultDefinition()->hasResult() ) + { + return true; + } + } + + for ( RimBoxIntersection* cs : m_intersectionBoxes ) + { + if ( cs->isActive() && cs->activeSeparateResultDefinition() && cs->activeSeparateResultDefinition()->hasResult() ) + { + return true; + } + } + return false; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h index 143a112914..b64dd49f18 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h +++ b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h @@ -59,6 +59,7 @@ public: void appendIntersectionBoxNoUpdate( RimBoxIntersection* intersectionBox ); bool hasActiveIntersectionForSimulationWell( const RimSimWellInView* simWell ) const; + bool hasAnyActiveSeparateResults(); void updateIntersectionBoxGeometry(); diff --git a/ApplicationCode/ProjectDataModel/RimIntersectionResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimIntersectionResultDefinition.cpp index 8fa2f3a03a..8c489355e8 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersectionResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimIntersectionResultDefinition.cpp @@ -226,8 +226,9 @@ RimGeoMechResultDefinition* RimIntersectionResultDefinition::geoMechResultDefini //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimIntersectionResultDefinition::updateLegendRangesTextAndVisibility( RiuViewer* nativeOrOverrideViewer, - bool isUsingOverrideViewer ) +void RimIntersectionResultDefinition::updateLegendRangesTextAndVisibility( const QString& title, + RiuViewer* nativeOrOverrideViewer, + bool isUsingOverrideViewer ) { if ( !this->isInAction() ) return; @@ -257,7 +258,7 @@ void RimIntersectionResultDefinition::updateLegendRangesTextAndVisibility( RiuVi this->ternaryLegendConfig(), this->timeStep() ); - eclResultDef->updateLegendTitle( this->regularLegendConfig(), "Intersection Results:\n" ); + eclResultDef->updateLegendTitle( this->regularLegendConfig(), title ); if ( this->regularLegendConfig()->showLegend() && eclResultDef->hasResult() ) { @@ -268,16 +269,14 @@ void RimIntersectionResultDefinition::updateLegendRangesTextAndVisibility( RiuVi eclResultDef->currentGridCellResults()->maxTimeStepCount() > 1 && this->ternaryLegendConfig()->showLegend() && this->ternaryLegendConfig()->titledOverlayFrame() ) { - this->ternaryLegendConfig()->setTitle( "Intersection Results: \n" ); + this->ternaryLegendConfig()->setTitle( title ); nativeOrOverrideViewer->addColorLegendToBottomLeftCorner( this->ternaryLegendConfig()->titledOverlayFrame(), isUsingOverrideViewer ); } } else { - this->geoMechResultDefinition()->updateLegendTextAndRanges( this->regularLegendConfig(), - "Intersection Results:\n", - this->timeStep() ); + this->geoMechResultDefinition()->updateLegendTextAndRanges( this->regularLegendConfig(), title, this->timeStep() ); if ( this->geoMechResultDefinition()->hasResult() && this->regularLegendConfig()->showLegend() ) { diff --git a/ApplicationCode/ProjectDataModel/RimIntersectionResultDefinition.h b/ApplicationCode/ProjectDataModel/RimIntersectionResultDefinition.h index 6d52be0d1c..0ced7628ff 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersectionResultDefinition.h +++ b/ApplicationCode/ProjectDataModel/RimIntersectionResultDefinition.h @@ -54,7 +54,9 @@ public: RimEclipseResultDefinition* eclipseResultDefinition() const; RimGeoMechResultDefinition* geoMechResultDefinition() const; - void updateLegendRangesTextAndVisibility( RiuViewer* nativeOrOverrideViewer, bool isUsingOverrideViewer ); + void updateLegendRangesTextAndVisibility( const QString& title, + RiuViewer* nativeOrOverrideViewer, + bool isUsingOverrideViewer ); protected: virtual caf::PdmFieldHandle* userDescriptionField() override; diff --git a/ApplicationCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp b/ApplicationCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp index 0ad46a18c2..ce26d8b48e 100644 --- a/ApplicationCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp +++ b/ApplicationCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp @@ -100,7 +100,7 @@ void RimSurfaceInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField const QVariant& oldValue, const QVariant& newValue ) { - if ( changedField == &m_isActive ) + if ( changedField == &m_isActive || changedField == &m_useSeparateDataSource || changedField == &m_separateDataSource ) { RimGridView* ownerView; this->firstAncestorOrThisOfTypeAsserted( ownerView ); diff --git a/ApplicationCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp b/ApplicationCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp index 2efbb14b9e..9cd57db4f9 100644 --- a/ApplicationCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp @@ -20,6 +20,7 @@ #include "RiaApplication.h" #include "RimGridView.h" +#include "RimIntersectionResultDefinition.h" #include "RimOilField.h" #include "RimProject.h" #include "RimSurfaceCollection.h" @@ -160,9 +161,11 @@ void RimSurfaceInViewCollection::updateCellResultColor( bool hasGeneralCellResul { if ( surf->isActive() ) { - bool hasSeparateInterResult = false; // surf->activeSeparateResultDefinition() && - // surf->activeSeparateResultDefinition()->hasResult(); - if ( hasSeparateInterResult || hasGeneralCellResult ) + bool showResults = surf->activeSeparateResultDefinition() + ? surf->activeSeparateResultDefinition()->hasResult() + : hasGeneralCellResult; + + if ( showResults ) { surf->surfacePartMgr()->updateCellResultColor( timeStepIndex ); } @@ -173,3 +176,38 @@ void RimSurfaceInViewCollection::updateCellResultColor( bool hasGeneralCellResul } } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSurfaceInViewCollection::applySingleColorEffect() +{ + if ( !this->m_isActive() ) return; + + for ( RimSurfaceInView* surf : m_surfacesInView ) + { + if ( surf->isActive() ) + { + surf->surfacePartMgr()->applySingleColor(); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSurfaceInViewCollection::hasAnyActiveSeparateResults() +{ + if ( !this->m_isActive() ) return false; + + for ( RimSurfaceInView* surf : m_surfacesInView ) + { + if ( surf->isActive() && surf->activeSeparateResultDefinition() && + surf->activeSeparateResultDefinition()->hasResult() ) + { + return true; + } + } + + return false; +} diff --git a/ApplicationCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.h b/ApplicationCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.h index fea77620c7..12548be985 100644 --- a/ApplicationCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.h +++ b/ApplicationCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.h @@ -43,6 +43,9 @@ public: void appendPartsToModel( cvf::ModelBasicList* surfaceVizModel, cvf::Transform* scaleTransform ); void updateCellResultColor( bool hasGeneralCellResult, size_t timeStepIndex ); + void applySingleColorEffect(); + + bool hasAnyActiveSeparateResults(); private: caf::PdmFieldHandle* objectToggleField() override;