2016-12-16 07:05:11 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2016- Statoil ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2016-12-16 07:05:11 -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
|
|
|
//
|
2016-12-16 07:05:11 -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>
|
2016-12-16 07:05:11 -06:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2017-01-02 04:59:30 -06:00
|
|
|
#include "RimWellPathFractureCollection.h"
|
2016-12-16 07:05:11 -06:00
|
|
|
|
2017-06-09 03:33:50 -05:00
|
|
|
#include "RimProject.h"
|
2017-01-02 04:59:30 -06:00
|
|
|
#include "RimWellPathFracture.h"
|
2017-06-09 03:33:50 -05:00
|
|
|
|
2016-12-16 07:05:11 -06:00
|
|
|
#include "cafPdmObject.h"
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_SOURCE_INIT( RimWellPathFractureCollection, "WellPathFractureCollection" );
|
2016-12-16 07:05:11 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-12-16 07:05:11 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-04-14 07:07:45 -05:00
|
|
|
RimWellPathFractureCollection::RimWellPathFractureCollection()
|
2016-12-16 07:05:11 -06:00
|
|
|
{
|
2022-01-07 01:31:52 -06:00
|
|
|
CAF_PDM_InitObject( "Fractures", ":/FractureLayout16x16.png" );
|
2016-12-16 07:05:11 -06:00
|
|
|
|
2021-11-14 07:15:12 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_fractures, "Fractures", "" );
|
2021-10-13 06:39:46 -05:00
|
|
|
m_fractures.uiCapability()->setUiTreeHidden( true );
|
2017-06-09 03:33:50 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
setName( "Fractures" );
|
|
|
|
nameField()->uiCapability()->setUiHidden( true );
|
2018-08-21 03:34:29 -05:00
|
|
|
|
2020-05-18 09:02:27 -05:00
|
|
|
setDeletable( true );
|
2016-12-16 07:05:11 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2016-12-16 07:05:11 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:13:38 -06:00
|
|
|
RimWellPathFractureCollection::~RimWellPathFractureCollection()
|
|
|
|
{
|
|
|
|
}
|
2017-01-02 03:12:43 -06:00
|
|
|
|
2018-08-21 03:34:29 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2021-02-26 07:27:59 -06:00
|
|
|
bool RimWellPathFractureCollection::hasFractures() const
|
2018-08-21 03:34:29 -05:00
|
|
|
{
|
2021-02-26 07:27:59 -06:00
|
|
|
return !m_fractures.empty();
|
2018-08-21 03:34:29 -05:00
|
|
|
}
|
|
|
|
|
2018-09-05 04:46:02 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-09-05 04:46:02 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimWellPathFractureCollection::addFracture( RimWellPathFracture* fracture )
|
2018-09-05 04:46:02 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_fractures.push_back( fracture );
|
2018-09-05 04:46:02 -05:00
|
|
|
}
|
|
|
|
|
2022-06-01 23:50:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellPathFractureCollection::removeFracture( RimWellPathFracture* fracture )
|
|
|
|
{
|
|
|
|
m_fractures.removeChild( fracture );
|
|
|
|
}
|
|
|
|
|
2017-01-02 03:12:43 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-01-02 03:12:43 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-02 04:59:30 -06:00
|
|
|
void RimWellPathFractureCollection::deleteFractures()
|
2017-01-02 03:12:43 -06:00
|
|
|
{
|
2022-05-31 06:08:07 -05:00
|
|
|
m_fractures.deleteChildren();
|
2017-01-02 03:12:43 -06:00
|
|
|
}
|
2017-06-09 03:33:50 -05:00
|
|
|
|
2018-09-05 04:46:02 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-09-05 04:46:02 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-09-07 06:32:53 -05:00
|
|
|
std::vector<RimWellPathFracture*> RimWellPathFractureCollection::allFractures() const
|
2018-09-05 04:46:02 -05:00
|
|
|
{
|
2023-05-12 14:41:34 -05:00
|
|
|
return m_fractures.childrenByType();
|
2018-09-05 04:46:02 -05:00
|
|
|
}
|
|
|
|
|
2018-08-21 03:34:29 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-09-07 06:24:56 -05:00
|
|
|
std::vector<RimWellPathFracture*> RimWellPathFractureCollection::activeFractures() const
|
|
|
|
{
|
|
|
|
std::vector<RimWellPathFracture*> active;
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( isChecked() )
|
2018-09-07 06:24:56 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( const auto& f : allFractures() )
|
2018-09-07 06:24:56 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( f->isChecked() )
|
2018-09-07 06:24:56 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
active.push_back( f );
|
2018-09-07 06:24:56 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return active;
|
|
|
|
}
|
|
|
|
|
2017-06-09 03:33:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2017-06-09 03:33:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-02-26 03:48:40 -06:00
|
|
|
void RimWellPathFractureCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
2017-06-09 03:33:50 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( changedField == &m_isChecked )
|
2017-06-20 10:22:14 -05:00
|
|
|
{
|
2021-01-26 08:32:18 -06:00
|
|
|
RimProject::current()->reloadCompletionTypeResultsInAllViews();
|
2017-06-20 10:22:14 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-26 08:32:18 -06:00
|
|
|
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
|
2017-06-20 10:22:14 -05:00
|
|
|
}
|
2017-06-09 03:33:50 -05:00
|
|
|
}
|
2018-12-18 06:43:21 -06:00
|
|
|
|
2021-01-26 08:32:18 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimWellPathFractureCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
|
|
|
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
|
|
|
{
|
|
|
|
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
|
|
|
|
}
|