2020-05-13 23:39:55 -05: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-11-04 06:46:17 -06:00
|
|
|
#include "RimStimPlanModelCollection.h"
|
2020-05-13 23:39:55 -05:00
|
|
|
|
|
|
|
#include "RimProject.h"
|
2020-11-04 06:46:17 -06:00
|
|
|
#include "RimStimPlanModel.h"
|
2020-05-13 23:39:55 -05:00
|
|
|
|
2020-08-21 04:13:07 -05:00
|
|
|
#include "cafPdmFieldScriptingCapability.h"
|
2020-05-13 23:39:55 -05:00
|
|
|
#include "cafPdmObject.h"
|
2020-08-21 04:13:07 -05:00
|
|
|
#include "cafPdmObjectScriptingCapability.h"
|
2020-05-13 23:39:55 -05:00
|
|
|
|
2020-11-04 06:46:17 -06:00
|
|
|
CAF_PDM_SOURCE_INIT( RimStimPlanModelCollection, "StimPlanModelCollection" );
|
2020-05-13 23:39:55 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-04-14 07:07:45 -05:00
|
|
|
RimStimPlanModelCollection::RimStimPlanModelCollection()
|
2020-05-13 23:39:55 -05:00
|
|
|
{
|
2021-11-14 07:15:12 -06:00
|
|
|
CAF_PDM_InitScriptableObject( "StimPlan Models" );
|
2020-05-13 23:39:55 -05:00
|
|
|
|
2021-11-14 07:15:12 -06:00
|
|
|
CAF_PDM_InitScriptableFieldNoDefault( &m_stimPlanModels, "StimPlanModels", "" );
|
2020-05-13 23:39:55 -05:00
|
|
|
|
2020-11-04 06:46:17 -06:00
|
|
|
setName( "StimPlan Models" );
|
2020-05-13 23:39:55 -05:00
|
|
|
nameField()->uiCapability()->setUiHidden( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-11-04 06:46:17 -06:00
|
|
|
RimStimPlanModelCollection::~RimStimPlanModelCollection()
|
2020-05-13 23:39:55 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-02-26 07:27:59 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimStimPlanModelCollection::hasStimPlanModels() const
|
|
|
|
{
|
|
|
|
return !m_stimPlanModels.empty();
|
|
|
|
}
|
|
|
|
|
2020-05-13 23:39:55 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-11-04 06:46:17 -06:00
|
|
|
void RimStimPlanModelCollection::addStimPlanModel( RimStimPlanModel* fracture )
|
2020-05-13 23:39:55 -05:00
|
|
|
{
|
2020-11-04 06:46:17 -06:00
|
|
|
m_stimPlanModels.push_back( fracture );
|
2020-05-13 23:39:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-11-04 06:46:17 -06:00
|
|
|
void RimStimPlanModelCollection::deleteStimPlanModels()
|
2020-05-13 23:39:55 -05:00
|
|
|
{
|
2022-05-31 06:08:07 -05:00
|
|
|
m_stimPlanModels.deleteChildren();
|
2020-05-13 23:39:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-11-04 06:46:17 -06:00
|
|
|
std::vector<RimStimPlanModel*> RimStimPlanModelCollection::allStimPlanModels() const
|
2020-05-13 23:39:55 -05:00
|
|
|
{
|
2023-05-12 14:41:34 -05:00
|
|
|
return m_stimPlanModels.childrenByType();
|
2020-05-13 23:39:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-11-04 06:46:17 -06:00
|
|
|
std::vector<RimStimPlanModel*> RimStimPlanModelCollection::activeStimPlanModels() const
|
2020-05-13 23:39:55 -05:00
|
|
|
{
|
2020-11-04 06:46:17 -06:00
|
|
|
std::vector<RimStimPlanModel*> active;
|
2020-05-13 23:39:55 -05:00
|
|
|
|
|
|
|
if ( isChecked() )
|
|
|
|
{
|
2020-11-04 06:46:17 -06:00
|
|
|
for ( const auto& f : allStimPlanModels() )
|
2020-05-13 23:39:55 -05:00
|
|
|
{
|
|
|
|
if ( f->isChecked() )
|
|
|
|
{
|
|
|
|
active.push_back( f );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return active;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-11-04 06:46:17 -06:00
|
|
|
void RimStimPlanModelCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
2020-05-13 23:39:55 -05:00
|
|
|
{
|
|
|
|
uiOrdering.skipRemainingFields( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-02-26 03:48:40 -06:00
|
|
|
void RimStimPlanModelCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
2020-05-13 23:39:55 -05:00
|
|
|
{
|
2023-05-12 14:41:34 -05:00
|
|
|
RimProject* proj = RimProject::current();
|
2020-05-13 23:39:55 -05:00
|
|
|
if ( changedField == &m_isChecked )
|
|
|
|
{
|
|
|
|
proj->reloadCompletionTypeResultsInAllViews();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
proj->scheduleCreateDisplayModelAndRedrawAllViews();
|
|
|
|
}
|
|
|
|
}
|