2022-05-11 12:17:46 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2022 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 "RimEclipseResultAddress.h"
|
|
|
|
|
|
|
|
#include "RimEclipseCase.h"
|
2022-06-13 06:54:55 -05:00
|
|
|
#include "RimEclipseCaseTools.h"
|
2022-05-11 12:17:46 -05:00
|
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT( RimEclipseResultAddress, "EclipseResultAddress" );
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimEclipseResultAddress::RimEclipseResultAddress()
|
|
|
|
{
|
2023-06-06 08:45:54 -05:00
|
|
|
CAF_PDM_InitObject( "EclipseResultAddress", ":/DataVector.svg", "", "" );
|
2022-05-11 12:17:46 -05:00
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_resultName, "ResultName", "Result Name" );
|
2022-05-23 07:25:53 -05:00
|
|
|
m_resultName.uiCapability()->setUiReadOnly( true );
|
|
|
|
|
2022-05-11 12:17:46 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_resultType, "ResultType", "Type" );
|
2022-05-23 07:25:53 -05:00
|
|
|
m_resultType.uiCapability()->setUiReadOnly( true );
|
|
|
|
|
2022-05-11 12:17:46 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case" );
|
2022-05-23 07:25:53 -05:00
|
|
|
m_eclipseCase.uiCapability()->setUiReadOnly( true );
|
2022-05-11 12:17:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimEclipseResultAddress::~RimEclipseResultAddress()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RimEclipseResultAddress::resultName() const
|
|
|
|
{
|
|
|
|
return m_resultName;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEclipseResultAddress::setResultName( const QString& resultName )
|
|
|
|
{
|
|
|
|
m_resultName = resultName;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEclipseResultAddress::setResultType( RiaDefines::ResultCatType val )
|
|
|
|
{
|
|
|
|
m_resultType = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RiaDefines::ResultCatType RimEclipseResultAddress::resultType() const
|
|
|
|
{
|
|
|
|
return m_resultType();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEclipseResultAddress::setEclipseCase( RimEclipseCase* eclipseCase )
|
|
|
|
{
|
|
|
|
m_eclipseCase = eclipseCase;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimEclipseCase* RimEclipseResultAddress::eclipseCase() const
|
|
|
|
{
|
|
|
|
return m_eclipseCase;
|
|
|
|
}
|
2022-05-23 07:25:53 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-05-29 06:01:27 -05:00
|
|
|
QList<caf::PdmOptionItemInfo> RimEclipseResultAddress::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
|
2022-05-23 07:25:53 -05:00
|
|
|
{
|
|
|
|
QList<caf::PdmOptionItemInfo> options;
|
|
|
|
|
|
|
|
if ( fieldNeedingOptions == &m_eclipseCase )
|
|
|
|
{
|
2022-06-13 06:54:55 -05:00
|
|
|
auto cases = RimEclipseCaseTools::eclipseCases();
|
|
|
|
for ( auto* c : cases )
|
2022-05-23 07:25:53 -05:00
|
|
|
{
|
2022-06-13 06:54:55 -05:00
|
|
|
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
|
2022-05-23 07:25:53 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|