2020-01-03 06:49:12 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2020- Equinor ASA
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RimSurfaceInView.h"
|
|
|
|
|
2020-01-08 04:56:48 -06:00
|
|
|
#include "RimGridView.h"
|
2020-01-03 06:49:12 -06:00
|
|
|
#include "RimSurface.h"
|
|
|
|
|
2020-01-09 07:20:10 -06:00
|
|
|
#include "RigFemPartCollection.h"
|
|
|
|
#include "RimEclipseView.h"
|
|
|
|
#include "RimGeoMechView.h"
|
|
|
|
#include "RivHexGridIntersectionTools.h"
|
2020-01-08 04:56:48 -06:00
|
|
|
#include "RivSurfacePartMgr.h"
|
|
|
|
|
2020-01-03 06:49:12 -06:00
|
|
|
CAF_PDM_SOURCE_INIT( RimSurfaceInView, "SurfaceInView" );
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimSurfaceInView::RimSurfaceInView()
|
|
|
|
{
|
2020-01-06 04:30:06 -06:00
|
|
|
CAF_PDM_InitObject( "Surface", ":/ReservoirSurface16x16.png", "", "" );
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name", "", "", "" );
|
|
|
|
m_name.registerGetMethod( this, &RimSurfaceInView::name );
|
2020-01-14 08:59:26 -06:00
|
|
|
m_name.uiCapability()->setUiReadOnly( true );
|
2020-01-06 04:30:06 -06:00
|
|
|
|
2020-01-03 06:49:12 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_surface, "SurfaceRef", "Surface", "", "", "" );
|
2020-01-06 04:30:06 -06:00
|
|
|
m_surface.uiCapability()->setUiHidden( true );
|
2020-01-03 06:49:12 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:13:38 -06:00
|
|
|
RimSurfaceInView::~RimSurfaceInView()
|
|
|
|
{
|
|
|
|
}
|
2020-01-03 06:49:12 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-01-06 04:30:06 -06:00
|
|
|
QString RimSurfaceInView::name() const
|
2020-01-03 06:49:12 -06:00
|
|
|
{
|
|
|
|
if ( m_surface ) return m_surface->userDescription();
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2020-01-06 04:30:06 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimSurface* RimSurfaceInView::surface() const
|
|
|
|
{
|
|
|
|
return m_surface();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSurfaceInView::setSurface( RimSurface* surf )
|
|
|
|
{
|
|
|
|
m_surface = surf;
|
|
|
|
}
|
|
|
|
|
2020-01-08 04:56:48 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSurfaceInView::clearGeometry()
|
|
|
|
{
|
|
|
|
m_surfacePartMgr = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RivSurfacePartMgr* RimSurfaceInView::surfacePartMgr()
|
|
|
|
{
|
|
|
|
if ( m_surfacePartMgr.isNull() ) m_surfacePartMgr = new RivSurfacePartMgr( this );
|
|
|
|
|
|
|
|
return m_surfacePartMgr.p();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSurfaceInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
|
|
|
const QVariant& oldValue,
|
|
|
|
const QVariant& newValue )
|
|
|
|
{
|
2020-01-21 08:13:29 -06:00
|
|
|
if ( changedField == &m_isActive || changedField == &m_useSeparateDataSource || changedField == &m_separateDataSource )
|
2020-01-08 04:56:48 -06:00
|
|
|
{
|
|
|
|
RimGridView* ownerView;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted( ownerView );
|
|
|
|
ownerView->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
2020-01-17 06:23:37 -06:00
|
|
|
else if ( changedField == &m_showInactiveCells )
|
|
|
|
{
|
|
|
|
m_surfacePartMgr = nullptr;
|
|
|
|
RimGridView* ownerView;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted( ownerView );
|
|
|
|
ownerView->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
2020-01-08 04:56:48 -06:00
|
|
|
}
|
|
|
|
|
2020-01-06 04:30:06 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-01-14 08:59:26 -06:00
|
|
|
void RimSurfaceInView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
2020-01-06 04:30:06 -06:00
|
|
|
{
|
2020-01-14 08:59:26 -06:00
|
|
|
uiOrdering.add( &m_name );
|
|
|
|
|
|
|
|
uiOrdering.add( &m_showInactiveCells );
|
|
|
|
|
|
|
|
this->defineSeparateDataSourceUi( uiConfigName, uiOrdering );
|
2020-01-06 04:30:06 -06:00
|
|
|
}
|
|
|
|
|
2020-01-14 08:59:26 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
2020-01-06 04:30:06 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-01-14 08:59:26 -06:00
|
|
|
RimIntersectionResultsDefinitionCollection* RimSurfaceInView::findSeparateResultsCollection()
|
2020-01-06 04:30:06 -06:00
|
|
|
{
|
2020-01-14 08:59:26 -06:00
|
|
|
RimGridView* view;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted( view );
|
|
|
|
return view->separateSurfaceResultsCollection();
|
2020-01-06 04:30:06 -06:00
|
|
|
}
|
2020-01-09 07:20:10 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-01-14 08:59:26 -06:00
|
|
|
caf::PdmFieldHandle* RimSurfaceInView::userDescriptionField()
|
2020-01-09 07:20:10 -06:00
|
|
|
{
|
2020-01-14 08:59:26 -06:00
|
|
|
return &m_name;
|
2020-01-09 07:20:10 -06:00
|
|
|
}
|