2012-06-26 16:10:41 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2014-09-23 15:04:57 +02:00
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2012-06-26 16:10:41 +02:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2012-06-26 16:10:41 +02:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2012-06-26 16:10:41 +02:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2015-06-25 13:14:04 +02:00
|
|
|
#include "RimEclipseInputPropertyCollection.h"
|
2012-06-26 16:10:41 +02:00
|
|
|
|
2026-05-11 10:05:34 +02:00
|
|
|
#include "RimEclipseInputProperty.h"
|
|
|
|
|
|
2014-07-24 10:11:43 +02:00
|
|
|
#include <QFileInfo>
|
2012-06-26 16:10:41 +02:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
CAF_PDM_SOURCE_INIT( RimEclipseInputPropertyCollection, "RimInputPropertyCollection" );
|
2012-06-26 16:10:41 +02:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2012-06-26 16:10:41 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 11:54:31 +02:00
|
|
|
RimEclipseInputPropertyCollection::RimEclipseInputPropertyCollection()
|
2012-06-26 16:10:41 +02:00
|
|
|
{
|
2022-01-07 08:31:52 +01:00
|
|
|
CAF_PDM_InitObject( "Input Properties", ":/EclipseInput48x48.png" );
|
2012-06-26 16:10:41 +02:00
|
|
|
|
2026-05-08 15:25:15 +02:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_items, "InputProperties", "" );
|
2012-06-26 16:10:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
/// Returns the InputProperties pointing to the same file as \a fileName
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
std::vector<RimEclipseInputProperty*> RimEclipseInputPropertyCollection::findInputProperties( QString fileName )
|
2012-06-26 16:10:41 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
QFileInfo fileInfo( fileName );
|
2015-06-25 11:51:59 +02:00
|
|
|
std::vector<RimEclipseInputProperty*> result;
|
2026-05-08 15:25:15 +02:00
|
|
|
for ( auto* prop : items() )
|
2012-06-26 16:10:41 +02:00
|
|
|
{
|
2026-05-08 15:25:15 +02:00
|
|
|
if ( !prop ) continue;
|
2012-06-26 16:10:41 +02:00
|
|
|
|
2026-05-08 15:25:15 +02:00
|
|
|
QFileInfo propFile( prop->fileName().path() );
|
|
|
|
|
if ( fileInfo == propFile ) result.push_back( prop );
|
2012-06-26 16:10:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
/// Returns the InputProperty with resultName \a resultName
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
RimEclipseInputProperty* RimEclipseInputPropertyCollection::findInputProperty( QString resultName )
|
2012-06-26 16:10:41 +02:00
|
|
|
{
|
2026-05-08 15:25:15 +02:00
|
|
|
for ( auto* prop : items() )
|
2012-06-26 16:10:41 +02:00
|
|
|
{
|
2026-05-08 15:25:15 +02:00
|
|
|
if ( prop && prop->resultName() == resultName ) return prop;
|
2012-06-26 16:10:41 +02:00
|
|
|
}
|
|
|
|
|
|
2018-02-18 18:56:43 +01:00
|
|
|
return nullptr;
|
2012-06-26 16:10:41 +02:00
|
|
|
}
|