#5316 Prototype of results mapping on native surface nodes only

This commit is contained in:
Jacob Støren
2020-01-09 14:20:10 +01:00
parent 17f2c71a11
commit 5b1b7e630a
7 changed files with 279 additions and 9 deletions

View File

@@ -21,6 +21,10 @@
#include "RimGridView.h"
#include "RimSurface.h"
#include "RigFemPartCollection.h"
#include "RimEclipseView.h"
#include "RimGeoMechView.h"
#include "RivHexGridIntersectionTools.h"
#include "RivSurfacePartMgr.h"
CAF_PDM_SOURCE_INIT( RimSurfaceInView, "SurfaceInView" );
@@ -134,3 +138,53 @@ caf::PdmFieldHandle* RimSurfaceInView::objectToggleField()
{
return &m_isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<RivIntersectionHexGridInterface> RimSurfaceInView::createHexGridInterface()
{
// RimIntersectionResultDefinition* resDef = activeSeparateResultDefinition();
// if ( resDef && resDef->activeCase() )
//{
// // Eclipse case
//
// RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( resDef->activeCase() );
// if ( eclipseCase && eclipseCase->eclipseCaseData() )
// {
// return new RivEclipseIntersectionGrid( eclipseCase->eclipseCaseData()->mainGrid(),
// eclipseCase->eclipseCaseData()->activeCellInfo(
// resDef->eclipseResultDefinition()->porosityModel() ),
// this->isInactiveCellsVisible() );
// }
//
// // Geomech case
//
// RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( resDef->activeCase() );
//
// if ( geomCase && geomCase->geoMechData() && geomCase->geoMechData()->femParts() )
// {
// RigFemPart* femPart = geomCase->geoMechData()->femParts()->part( 0 );
// return new RivFemIntersectionGrid( femPart );
// }
//}
RimEclipseView* eclipseView;
this->firstAncestorOrThisOfType( eclipseView );
if ( eclipseView )
{
RigMainGrid* grid = eclipseView->mainGrid();
return new RivEclipseIntersectionGrid( grid, eclipseView->currentActiveCellInfo(), true );
}
RimGeoMechView* geoView;
this->firstAncestorOrThisOfType( geoView );
if ( geoView && geoView->femParts() && geoView->femParts()->partCount() )
{
RigFemPart* femPart = geoView->femParts()->part( 0 );
return new RivFemIntersectionGrid( femPart );
}
return nullptr;
}

View File

@@ -26,6 +26,7 @@
class RimSurface;
class RivSurfacePartMgr;
class RivIntersectionHexGridInterface;
class RimSurfaceInView : public caf::PdmObject
{
@@ -45,10 +46,12 @@ public:
void clearGeometry();
RivSurfacePartMgr* surfacePartMgr();
cvf::ref<RivIntersectionHexGridInterface> createHexGridInterface();
private:
caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmFieldHandle* objectToggleField() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
void fieldChangedByUi(const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;

View File

@@ -147,3 +147,28 @@ caf::PdmFieldHandle* RimSurfaceInViewCollection::objectToggleField()
{
return &m_isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSurfaceInViewCollection::updateCellResultColor( bool hasGeneralCellResult, size_t timeStepIndex )
{
if ( !this->m_isActive() ) return;
for ( RimSurfaceInView* surf : m_surfacesInView )
{
if ( surf->isActive() )
{
bool hasSeparateInterResult = false; // surf->activeSeparateResultDefinition() &&
// surf->activeSeparateResultDefinition()->hasResult();
if ( hasSeparateInterResult || hasGeneralCellResult )
{
surf->surfacePartMgr()->updateCellResultColor( timeStepIndex );
}
else
{
surf->surfacePartMgr()->applySingleColor();
}
}
}
}

View File

@@ -42,6 +42,7 @@ public:
void updateFromSurfaceCollection();
void appendPartsToModel( cvf::ModelBasicList* surfaceVizModel, cvf::Transform* scaleTransform );
void updateCellResultColor( bool hasGeneralCellResult, size_t timeStepIndex );
private:
caf::PdmFieldHandle* objectToggleField() override;