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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
2020-02-19 02:17:25 -06:00
|
|
|
|
2020-01-03 06:49:12 -06:00
|
|
|
#include "RimSurface.h"
|
|
|
|
|
2020-01-08 04:56:48 -06:00
|
|
|
#include "RimSurfaceCollection.h"
|
|
|
|
|
2020-01-03 06:49:12 -06:00
|
|
|
#include "RigSurface.h"
|
2020-01-08 04:56:48 -06:00
|
|
|
|
2020-02-19 02:17:25 -06:00
|
|
|
#include "RifSurfaceReader.h"
|
2020-01-09 01:48:05 -06:00
|
|
|
|
2020-02-19 02:17:25 -06:00
|
|
|
#include <QFileInfo>
|
2020-01-03 06:49:12 -06:00
|
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT( RimSurface, "Surface" );
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimSurface::RimSurface()
|
|
|
|
{
|
2020-01-03 08:53:45 -06:00
|
|
|
CAF_PDM_InitObject( "Surface", ":/ReservoirSurface16x16.png", "", "" );
|
2020-01-03 06:49:12 -06:00
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_userDescription, "SurfaceUserDecription", "Name", "", "", "" );
|
|
|
|
CAF_PDM_InitField( &m_color, "SurfaceColor", cvf::Color3f( 0.5f, 0.3f, 0.2f ), "Color", "", "", "" );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:13:38 -06:00
|
|
|
RimSurface::~RimSurface()
|
|
|
|
{
|
|
|
|
}
|
2020-01-03 06:49:12 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-05-03 04:29:33 -05:00
|
|
|
void RimSurface::setColor( const cvf::Color3f& color )
|
2020-01-03 06:49:12 -06:00
|
|
|
{
|
2020-05-03 04:29:33 -05:00
|
|
|
m_color = color;
|
2020-01-03 06:49:12 -06:00
|
|
|
}
|
|
|
|
|
2020-01-08 04:56:48 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-05-03 04:29:33 -05:00
|
|
|
cvf::Color3f RimSurface::color() const
|
2020-01-08 04:56:48 -06:00
|
|
|
{
|
2020-05-03 04:29:33 -05:00
|
|
|
return m_color();
|
2020-01-08 04:56:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-05-03 04:29:33 -05:00
|
|
|
QString RimSurface::userDescription()
|
2020-01-08 04:56:48 -06:00
|
|
|
{
|
2020-05-03 04:29:33 -05:00
|
|
|
return m_userDescription();
|
2020-01-08 04:56:48 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-05-03 04:29:33 -05:00
|
|
|
bool RimSurface::loadData()
|
2020-01-08 04:56:48 -06:00
|
|
|
{
|
2020-05-03 04:29:33 -05:00
|
|
|
return true;
|
2020-01-08 04:56:48 -06:00
|
|
|
}
|
|
|
|
|
2020-01-03 06:49:12 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-05-03 04:29:33 -05:00
|
|
|
void RimSurface::setUserDescription( const QString& description )
|
2020-01-03 06:49:12 -06:00
|
|
|
{
|
2020-05-03 04:29:33 -05:00
|
|
|
m_userDescription = description;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimSurface::setSurfaceData( RigSurface* surface )
|
|
|
|
{
|
|
|
|
m_surfaceData = surface;
|
2020-01-03 06:49:12 -06:00
|
|
|
}
|
|
|
|
|
2020-01-08 04:56:48 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigSurface* RimSurface::surfaceData()
|
|
|
|
{
|
|
|
|
return m_surfaceData.p();
|
|
|
|
}
|
|
|
|
|
2020-01-06 04:30:06 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
caf::PdmFieldHandle* RimSurface::userDescriptionField()
|
|
|
|
{
|
|
|
|
return &m_userDescription;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:43:15 -06:00
|
|
|
void RimSurface::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
2020-01-06 04:30:06 -06:00
|
|
|
{
|
2020-05-03 04:29:33 -05:00
|
|
|
if ( changedField == &m_color )
|
2020-01-06 04:30:06 -06:00
|
|
|
{
|
2020-01-08 04:56:48 -06:00
|
|
|
RimSurfaceCollection* surfColl;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted( surfColl );
|
|
|
|
surfColl->updateViews( {this} );
|
2020-01-06 04:30:06 -06:00
|
|
|
}
|
|
|
|
}
|