2018-03-05 07:17:18 -06:00
|
|
|
#include "RicfSetExportFolder.h"
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017 Statoil ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2018-03-05 07:17:18 -06: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 03:40:57 -05:00
|
|
|
//
|
2018-03-05 07:17:18 -06: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 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2018-03-05 07:17:18 -06:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RicfSetFractureContainment.h"
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
#include "RiaLogging.h"
|
|
|
|
|
|
|
|
#include "RimFractureTemplate.h"
|
|
|
|
#include "RimFractureTemplateCollection.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RimProject.h"
|
2018-03-05 07:17:18 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_SOURCE_INIT( RicfSetFractureContainment, "setFractureContainment" );
|
2018-03-05 07:17:18 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-03-05 07:17:18 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RicfSetFractureContainment::RicfSetFractureContainment()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
RICF_InitField( &m_id, "id", -1, "Id", "", "", "" );
|
|
|
|
RICF_InitField( &m_topLayer, "topLayer", -1, "TopLayer", "", "", "" );
|
|
|
|
RICF_InitField( &m_baseLayer, "baseLayer", -1, "BaseLayer", "", "", "" );
|
2018-03-05 07:17:18 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-03-05 07:17:18 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-05-23 06:59:19 -05:00
|
|
|
RicfCommandResponse RicfSetFractureContainment::execute()
|
2018-03-05 07:17:18 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_id < 0 || m_topLayer < 0 || m_baseLayer < 0 )
|
2018-03-05 07:17:18 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString error( "setFractureContainment: Required argument missing" );
|
|
|
|
RiaLogging::error( error );
|
|
|
|
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
2018-03-05 07:17:18 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
RimProject* project = RiaApplication::instance()->project();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !project )
|
2018-03-05 07:17:18 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString error( "setFractureContainment: Project not found" );
|
|
|
|
RiaLogging::error( error );
|
|
|
|
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
2018-03-05 07:17:18 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
RimFractureTemplateCollection* templColl = !project->allFractureTemplateCollections().empty()
|
|
|
|
? project->allFractureTemplateCollections()[0]
|
|
|
|
: nullptr;
|
|
|
|
RimFractureTemplate* templ = templColl ? templColl->fractureTemplate( m_id ) : nullptr;
|
|
|
|
|
|
|
|
if ( !templ )
|
2018-03-05 07:17:18 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString error = QString( "setFractureContainment: Fracture template not found. Id=%1" ).arg( m_id );
|
|
|
|
RiaLogging::error( error );
|
|
|
|
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
2018-03-05 07:17:18 -06:00
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
templ->setContainmentTopKLayer( m_topLayer );
|
|
|
|
templ->setContainmentBaseKLayer( m_baseLayer );
|
2018-09-13 01:32:27 -05:00
|
|
|
templ->loadDataAndUpdateGeometryHasChanged();
|
2019-05-23 06:59:19 -05:00
|
|
|
return RicfCommandResponse();
|
2018-03-05 07:17:18 -06:00
|
|
|
}
|