#5317 Made RimSurfaceInView inherit RimIntersection

to get all the separate results stuff from there.
This commit is contained in:
Jacob Støren 2020-01-14 15:59:26 +01:00
parent 2fa27f8718
commit 63eea9de10
5 changed files with 56 additions and 94 deletions

View File

@ -95,6 +95,8 @@ RimGridView::RimGridView()
"" ); "" );
m_surfaceResultDefCollection.uiCapability()->setUiTreeHidden( true ); m_surfaceResultDefCollection.uiCapability()->setUiTreeHidden( true );
m_surfaceResultDefCollection = new RimIntersectionResultsDefinitionCollection; m_surfaceResultDefCollection = new RimIntersectionResultsDefinitionCollection;
m_surfaceResultDefCollection->uiCapability()->setUiName( "Separate Surface Results" );
m_surfaceResultDefCollection->uiCapability()->setUiIcon( caf::QIconProvider( ":/ReservoirSurface16x16.png" ) );
CAF_PDM_InitFieldNoDefault( &m_gridCollection, "GridCollection", "GridCollection", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_gridCollection, "GridCollection", "GridCollection", "", "", "" );
m_gridCollection.uiCapability()->setUiHidden( true ); m_gridCollection.uiCapability()->setUiHidden( true );

View File

@ -87,10 +87,9 @@ RimIntersectionResultDefinition* RimIntersection::activeSeparateResultDefinition
if ( !m_separateDataSource->isActive() ) return nullptr; if ( !m_separateDataSource->isActive() ) return nullptr;
RimGridView* view; if ( !findSeparateResultsCollection() ) return nullptr;
this->firstAncestorOrThisOfTypeAsserted( view );
if ( !view->separateIntersectionResultsCollection()->isActive() ) return nullptr; if ( !findSeparateResultsCollection()->isActive() ) return nullptr;
return m_separateDataSource; return m_separateDataSource;
} }
@ -105,11 +104,8 @@ QList<caf::PdmOptionItemInfo> RimIntersection::calculateValueOptions( const caf:
if ( fieldNeedingOptions == &m_separateDataSource ) if ( fieldNeedingOptions == &m_separateDataSource )
{ {
RimGridView* view;
this->firstAncestorOrThisOfTypeAsserted( view );
std::vector<RimIntersectionResultDefinition*> iResDefs = std::vector<RimIntersectionResultDefinition*> iResDefs =
view->separateIntersectionResultsCollection()->intersectionResultsDefinitions(); findSeparateResultsCollection()->intersectionResultsDefinitions();
for ( auto iresdef : iResDefs ) for ( auto iresdef : iResDefs )
{ {
@ -120,6 +116,16 @@ QList<caf::PdmOptionItemInfo> RimIntersection::calculateValueOptions( const caf:
return options; return options;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionResultsDefinitionCollection* RimIntersection::findSeparateResultsCollection()
{
RimGridView* view;
this->firstAncestorOrThisOfTypeAsserted( view );
return view->separateIntersectionResultsCollection();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -163,18 +169,12 @@ void RimIntersection::updateDefaultSeparateDataSource()
{ {
if ( m_separateDataSource() == nullptr ) if ( m_separateDataSource() == nullptr )
{ {
RimGridView* view; std::vector<RimIntersectionResultDefinition*> iResDefs =
this->firstAncestorOrThisOfType( view ); findSeparateResultsCollection()->intersectionResultsDefinitions();
if ( view ) if ( iResDefs.size() )
{ {
std::vector<RimIntersectionResultDefinition*> iResDefs = m_separateDataSource = iResDefs[0];
view->separateIntersectionResultsCollection()->intersectionResultsDefinitions();
if ( iResDefs.size() )
{
m_separateDataSource = iResDefs[0];
}
} }
} }
} }

View File

@ -26,6 +26,7 @@
class RimIntersectionResultDefinition; class RimIntersectionResultDefinition;
class RivIntersectionHexGridInterface; class RivIntersectionHexGridInterface;
class RimIntersectionResultsDefinitionCollection;
class RimIntersection : public caf::PdmObject class RimIntersection : public caf::PdmObject
{ {
@ -45,6 +46,8 @@ public:
cvf::ref<RivIntersectionHexGridInterface> createHexGridInterface(); cvf::ref<RivIntersectionHexGridInterface> createHexGridInterface();
protected: protected:
virtual RimIntersectionResultsDefinitionCollection* findSeparateResultsCollection();
caf::PdmFieldHandle* objectToggleField() override final; caf::PdmFieldHandle* objectToggleField() override final;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override; bool* useOptionsOnly ) override;

View File

@ -36,11 +36,9 @@ RimSurfaceInView::RimSurfaceInView()
{ {
CAF_PDM_InitObject( "Surface", ":/ReservoirSurface16x16.png", "", "" ); CAF_PDM_InitObject( "Surface", ":/ReservoirSurface16x16.png", "", "" );
CAF_PDM_InitField( &m_isActive, "IsActive", true, "Visible", "", "", "" );
m_isActive.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name", "", "", "" );
m_name.registerGetMethod( this, &RimSurfaceInView::name ); m_name.registerGetMethod( this, &RimSurfaceInView::name );
m_name.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitFieldNoDefault( &m_surface, "SurfaceRef", "Surface", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_surface, "SurfaceRef", "Surface", "", "", "" );
m_surface.uiCapability()->setUiHidden( true ); m_surface.uiCapability()->setUiHidden( true );
@ -77,14 +75,6 @@ void RimSurfaceInView::setSurface( RimSurface* surf )
m_surface = surf; m_surface = surf;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimSurfaceInView::isActive()
{
return m_isActive();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -118,6 +108,30 @@ void RimSurfaceInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSurfaceInView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_name );
uiOrdering.add( &m_showInactiveCells );
this->defineSeparateDataSourceUi( uiConfigName, uiOrdering );
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionResultsDefinitionCollection* RimSurfaceInView::findSeparateResultsCollection()
{
RimGridView* view;
this->firstAncestorOrThisOfTypeAsserted( view );
return view->separateSurfaceResultsCollection();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -125,61 +139,3 @@ caf::PdmFieldHandle* RimSurfaceInView::userDescriptionField()
{ {
return &m_name; return &m_name;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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

@ -24,11 +24,14 @@
#include "cvfObject.h" #include "cvfObject.h"
#include "RimIntersection.h"
class RimSurface; class RimSurface;
class RivSurfacePartMgr; class RivSurfacePartMgr;
class RivIntersectionHexGridInterface; class RivIntersectionHexGridInterface;
class RimSurfaceInView : public caf::PdmObject class RimSurfaceInView : public RimIntersection
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
@ -36,25 +39,23 @@ public:
RimSurfaceInView(); RimSurfaceInView();
~RimSurfaceInView() override; ~RimSurfaceInView() override;
QString name() const; QString name() const override;
RimSurface* surface() const; RimSurface* surface() const;
void setSurface( RimSurface* surf ); void setSurface( RimSurface* surf );
bool isActive();
void clearGeometry(); void clearGeometry();
RivSurfacePartMgr* surfacePartMgr(); RivSurfacePartMgr* surfacePartMgr();
cvf::ref<RivIntersectionHexGridInterface> createHexGridInterface();
private: private:
virtual RimIntersectionResultsDefinitionCollection* findSeparateResultsCollection() override;
caf::PdmFieldHandle* userDescriptionField() override; 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& oldValue,
const QVariant& newValue ) override; const QVariant& newValue ) override;
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
caf::PdmProxyValueField<QString> m_name; caf::PdmProxyValueField<QString> m_name;
caf::PdmField<bool> m_isActive;
caf::PdmPtrField<RimSurface*> m_surface; caf::PdmPtrField<RimSurface*> m_surface;
cvf::ref<RivSurfacePartMgr> m_surfacePartMgr; cvf::ref<RivSurfacePartMgr> m_surfacePartMgr;