2014-07-29 01:49:54 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2014-09-24 00:14:52 -05:00
|
|
|
// Copyright (C) Statoil ASA
|
|
|
|
// Copyright (C) Ceetron Solutions AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2014-07-29 01:49:54 -05: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
|
|
|
//
|
2014-07-29 01:49:54 -05: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>
|
2014-07-29 01:49:54 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-06-25 06:32:00 -05:00
|
|
|
#include "RimEclipseFaultColors.h"
|
2014-07-29 01:49:54 -05:00
|
|
|
|
2015-05-15 02:16:33 -05:00
|
|
|
#include "RimEclipseCase.h"
|
2015-06-25 06:32:00 -05:00
|
|
|
#include "RimEclipseCellColors.h"
|
2015-12-08 10:43:07 -06:00
|
|
|
#include "RimEclipseView.h"
|
2020-01-29 07:50:41 -06:00
|
|
|
#include "RimFaultInViewCollection.h"
|
2015-12-08 10:43:07 -06:00
|
|
|
|
2014-09-04 02:30:00 -05:00
|
|
|
#include "RiuMainWindow.h"
|
2015-08-10 01:00:16 -05:00
|
|
|
|
2015-08-09 07:12:09 -05:00
|
|
|
#include "cafPdmUiTreeOrdering.h"
|
2014-07-30 07:26:39 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_PDM_SOURCE_INIT( RimEclipseFaultColors, "RimFaultResultSlot" );
|
2014-07-29 01:49:54 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2014-07-29 01:49:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 05:06:43 -05:00
|
|
|
RimEclipseFaultColors::RimEclipseFaultColors()
|
2014-07-29 01:49:54 -05:00
|
|
|
{
|
2022-01-07 01:31:52 -06:00
|
|
|
CAF_PDM_InitObject( "Fault Result", ":/draw_style_faults_24x24.png" );
|
2014-07-29 01:49:54 -05:00
|
|
|
|
2021-11-14 07:15:12 -06:00
|
|
|
CAF_PDM_InitField( &showCustomFaultResult, "ShowCustomFaultResult", false, "Show Custom Fault Result" );
|
2019-09-06 03:40:57 -05:00
|
|
|
showCustomFaultResult.uiCapability()->setUiHidden( true );
|
2014-08-01 02:40:35 -05:00
|
|
|
|
2022-01-07 01:31:52 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_customFaultResultColors, "CustomResultSlot", "Custom Fault Result", ":/CellResult.png" );
|
2015-06-26 02:39:05 -05:00
|
|
|
m_customFaultResultColors = new RimEclipseCellColors();
|
2021-10-13 06:39:46 -05:00
|
|
|
m_customFaultResultColors.uiCapability()->setUiTreeHidden( true );
|
2021-02-10 20:01:17 -06:00
|
|
|
m_customFaultResultColors->enableDeltaResults( true );
|
2014-07-29 01:49:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2014-07-29 01:49:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 05:06:43 -05:00
|
|
|
RimEclipseFaultColors::~RimEclipseFaultColors()
|
2014-07-29 01:49:54 -05:00
|
|
|
{
|
2015-12-09 06:52:25 -06:00
|
|
|
delete m_customFaultResultColors;
|
2018-02-18 11:56:43 -06:00
|
|
|
m_customFaultResultColors = nullptr;
|
2014-07-29 01:49:54 -05:00
|
|
|
}
|
|
|
|
|
2014-07-30 07:26:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2014-07-30 07:26:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEclipseFaultColors::setReservoirView( RimEclipseView* ownerReservoirView )
|
2014-07-30 07:26:39 -05:00
|
|
|
{
|
2014-07-31 01:46:30 -05:00
|
|
|
m_reservoirView = ownerReservoirView;
|
2019-09-06 03:40:57 -05:00
|
|
|
m_customFaultResultColors->setReservoirView( ownerReservoirView );
|
2014-07-30 07:26:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2014-07-30 07:26:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-02-26 03:48:40 -06:00
|
|
|
void RimEclipseFaultColors::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
2014-07-30 07:26:39 -05:00
|
|
|
{
|
2023-08-04 02:04:14 -05:00
|
|
|
updateUiIconFromToggleField();
|
2014-08-01 05:55:43 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_reservoirView ) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
2014-07-30 07:26:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2014-07-30 07:26:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 05:06:43 -05:00
|
|
|
void RimEclipseFaultColors::initAfterRead()
|
2014-07-30 07:26:39 -05:00
|
|
|
{
|
2015-06-26 02:39:05 -05:00
|
|
|
m_customFaultResultColors->initAfterRead();
|
2014-08-01 05:55:43 -05:00
|
|
|
|
2023-08-04 02:04:14 -05:00
|
|
|
updateUiIconFromToggleField();
|
2014-07-30 07:26:39 -05:00
|
|
|
}
|
|
|
|
|
2014-07-31 01:46:30 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2014-07-31 01:46:30 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 05:06:43 -05:00
|
|
|
RimEclipseCellColors* RimEclipseFaultColors::customFaultResult()
|
2014-07-31 01:46:30 -05:00
|
|
|
{
|
2023-08-04 02:04:14 -05:00
|
|
|
return m_customFaultResultColors();
|
2014-07-30 07:26:39 -05:00
|
|
|
}
|
|
|
|
|
2018-02-13 06:29:44 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-02-13 06:29:44 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEclipseFaultColors::updateUiFieldsFromActiveResult()
|
|
|
|
{
|
|
|
|
m_customFaultResultColors->updateUiFieldsFromActiveResult();
|
|
|
|
}
|
|
|
|
|
2014-08-01 02:40:35 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2014-08-01 02:40:35 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 05:06:43 -05:00
|
|
|
caf::PdmFieldHandle* RimEclipseFaultColors::objectToggleField()
|
2014-08-01 02:40:35 -05:00
|
|
|
{
|
|
|
|
return &showCustomFaultResult;
|
|
|
|
}
|
|
|
|
|
2014-08-01 05:55:43 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2014-08-01 05:55:43 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEclipseFaultColors::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
2014-08-01 05:55:43 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup( "Result" );
|
|
|
|
m_customFaultResultColors->uiOrdering( uiConfigName, *group1 );
|
2023-05-12 14:41:34 -05:00
|
|
|
auto eclipseView = firstAncestorOfType<RimEclipseView>();
|
2020-01-29 07:50:41 -06:00
|
|
|
if ( eclipseView )
|
|
|
|
{
|
|
|
|
eclipseView->faultCollection()->uiOrderingFaults( uiConfigName, uiOrdering );
|
|
|
|
}
|
2019-09-06 03:40:57 -05:00
|
|
|
}
|
2014-08-01 05:55:43 -05:00
|
|
|
|
2014-08-26 04:47:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2014-08-26 04:47:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 05:06:43 -05:00
|
|
|
bool RimEclipseFaultColors::hasValidCustomResult()
|
2014-08-26 04:47:14 -05:00
|
|
|
{
|
2023-08-04 02:04:14 -05:00
|
|
|
if ( showCustomFaultResult() )
|
2014-08-26 04:47:14 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_customFaultResultColors->hasResult() || m_customFaultResultColors->isTernarySaturationSelected() )
|
2014-09-04 02:30:00 -05:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2015-08-09 07:12:09 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-08-09 07:12:09 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimEclipseFaultColors::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
|
2015-08-09 07:12:09 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
m_customFaultResultColors()->defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
|
2015-08-09 07:12:09 -05:00
|
|
|
}
|