2015-11-18 09:15:13 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2015-11-18 09:15:13 +01: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
|
|
|
//
|
2015-11-18 09:15:13 +01: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>
|
2015-11-18 09:15:13 +01:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2016-09-21 10:52:16 +02:00
|
|
|
#include "RimIntersectionCollection.h"
|
2015-11-18 09:15:13 +01:00
|
|
|
|
2022-01-05 15:52:04 +01:00
|
|
|
#include "RigMainGrid.h"
|
|
|
|
|
|
2018-02-01 17:45:22 +01:00
|
|
|
#include "Rim2dIntersectionView.h"
|
2018-03-02 11:25:47 +01:00
|
|
|
#include "Rim2dIntersectionViewCollection.h"
|
2018-01-23 14:23:28 +01:00
|
|
|
#include "Rim3dView.h"
|
2019-11-26 13:56:02 +01:00
|
|
|
#include "RimBoxIntersection.h"
|
2018-01-23 14:23:28 +01:00
|
|
|
#include "RimCase.h"
|
2022-01-05 15:52:04 +01:00
|
|
|
#include "RimEclipseView.h"
|
2019-11-26 11:35:21 +01:00
|
|
|
#include "RimExtrudedCurveIntersection.h"
|
2021-10-05 14:28:00 +02:00
|
|
|
#include "RimGridView.h"
|
2022-01-06 08:39:22 +01:00
|
|
|
#include "RimIntersectionResultDefinition.h"
|
|
|
|
|
#include "RimIntersectionResultsDefinitionCollection.h"
|
2023-06-08 09:13:22 +02:00
|
|
|
#include "RimProject.h"
|
2017-10-13 09:29:42 +02:00
|
|
|
#include "RimSimWellInView.h"
|
2015-11-18 09:15:13 +01:00
|
|
|
|
2018-02-27 15:53:33 +01:00
|
|
|
#include "Riu3DMainWindowTools.h"
|
2016-07-27 08:05:44 +02:00
|
|
|
|
2019-11-26 13:14:55 +01:00
|
|
|
#include "RivBoxIntersectionPartMgr.h"
|
2019-11-26 11:51:54 +01:00
|
|
|
#include "RivExtrudedCurveIntersectionPartMgr.h"
|
2016-07-27 08:05:44 +02:00
|
|
|
|
2022-02-07 18:38:19 +01:00
|
|
|
#include "cafPdmObjectScriptingCapability.h"
|
2022-01-05 15:52:04 +01:00
|
|
|
#include "cafPdmUiCheckBoxEditor.h"
|
|
|
|
|
#include "cafPdmUiDoubleSliderEditor.h"
|
2021-10-05 14:28:00 +02:00
|
|
|
#include "cafPdmUiTreeOrdering.h"
|
2023-06-05 07:33:04 +02:00
|
|
|
|
2019-11-14 13:59:31 +01:00
|
|
|
#include "cvfModelBasicList.h"
|
|
|
|
|
|
2022-02-07 18:38:19 +01:00
|
|
|
CAF_PDM_SOURCE_INIT( RimIntersectionCollection, "IntersectionCollection", "CrossSectionCollection" );
|
2015-11-18 09:15:13 +01:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-18 09:15:13 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 10:52:16 +02:00
|
|
|
RimIntersectionCollection::RimIntersectionCollection()
|
2015-11-18 09:15:13 +01:00
|
|
|
{
|
2022-02-07 18:38:19 +01:00
|
|
|
CAF_PDM_InitScriptableObject( "Intersections", ":/CrossSections16x16.png" );
|
2015-11-18 09:15:13 +01:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_intersections, "CrossSections", "Intersections" );
|
2021-10-13 13:39:46 +02:00
|
|
|
m_intersections.uiCapability()->setUiTreeHidden( true );
|
2015-11-18 09:15:13 +01:00
|
|
|
|
2021-11-14 14:15:12 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_intersectionBoxes, "IntersectionBoxes", "IntersectionBoxes" );
|
2021-10-13 13:39:46 +02:00
|
|
|
m_intersectionBoxes.uiCapability()->setUiTreeHidden( true );
|
2016-09-30 08:40:46 +02:00
|
|
|
|
2023-06-05 07:33:04 +02:00
|
|
|
CAF_PDM_InitField( &m_isActive, "Active", true, "Active" );
|
|
|
|
|
m_isActive.uiCapability()->setUiHidden( true );
|
2022-01-05 15:52:04 +01:00
|
|
|
|
2022-01-16 23:56:00 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_depthUpperThreshold, "UpperDepthThreshold", "Upper Threshold" );
|
|
|
|
|
m_depthUpperThreshold.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
2022-01-05 15:52:04 +01:00
|
|
|
|
2022-01-16 23:56:00 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_depthLowerThreshold, "LowerDepthThreshold", "Lower Threshold" );
|
|
|
|
|
m_depthLowerThreshold.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
|
|
|
|
|
|
|
|
|
CAF_PDM_InitField( &m_depthThresholdOverridden, "DepthFilterOverride", false, "Override Intersection Depth Filters" );
|
2022-01-05 15:52:04 +01:00
|
|
|
|
2022-01-16 23:56:00 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_depthFilterType, "CollectionDepthFilterType", "Depth Filter Type" );
|
2023-05-25 08:14:43 +02:00
|
|
|
|
2023-06-05 14:32:23 +02:00
|
|
|
CAF_PDM_InitField( &m_kFilterOverridden, "OverrideKFilter", false, "Override Intersection K Range Filters" );
|
2023-05-25 08:14:43 +02:00
|
|
|
|
2023-05-26 08:59:13 +02:00
|
|
|
CAF_PDM_InitFieldNoDefault( &m_kFilterStr, "KRangeFilter", "K Range Filter", "", "Example: 2,4-6,10-30:2", "" );
|
2023-06-05 07:33:04 +02:00
|
|
|
|
2023-06-05 14:32:23 +02:00
|
|
|
CAF_PDM_InitField( &m_applyCellFilters, "ApplyCellFilters", true, "Use Cell Filters for Intersections" );
|
2015-11-18 09:15:13 +01:00
|
|
|
}
|
|
|
|
|
|
2015-12-03 08:26:38 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-12-03 08:26:38 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 10:52:16 +02:00
|
|
|
RimIntersectionCollection::~RimIntersectionCollection()
|
2015-12-03 08:26:38 +01:00
|
|
|
{
|
2022-05-31 13:08:07 +02:00
|
|
|
m_intersections.deleteChildren();
|
|
|
|
|
m_intersectionBoxes.deleteChildren();
|
2015-12-03 08:26:38 +01:00
|
|
|
}
|
|
|
|
|
|
2015-11-18 09:15:13 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-18 09:15:13 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 10:52:16 +02:00
|
|
|
caf::PdmFieldHandle* RimIntersectionCollection::objectToggleField()
|
2015-11-18 09:15:13 +01:00
|
|
|
{
|
2023-06-05 07:33:04 +02:00
|
|
|
return &m_isActive;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
bool RimIntersectionCollection::isActive() const
|
|
|
|
|
{
|
|
|
|
|
return m_isActive();
|
2015-11-18 09:15:13 +01:00
|
|
|
}
|
2015-11-19 11:41:16 +01:00
|
|
|
|
2021-10-05 14:28:00 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-02-26 10:48:40 +01:00
|
|
|
void RimIntersectionCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= "" */ )
|
2021-10-05 14:28:00 +02:00
|
|
|
{
|
2023-05-12 21:41:34 +02:00
|
|
|
auto gridView = firstAncestorOfType<RimGridView>();
|
2021-10-05 14:28:00 +02:00
|
|
|
if ( gridView )
|
|
|
|
|
{
|
|
|
|
|
auto uiTree = gridView->separateIntersectionResultsCollection()->uiTreeOrdering();
|
|
|
|
|
|
|
|
|
|
uiTreeOrdering.appendChild( uiTree );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-19 11:41:16 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-19 11:41:16 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 10:52:16 +02:00
|
|
|
void RimIntersectionCollection::applySingleColorEffect()
|
2015-11-19 11:41:16 +01:00
|
|
|
{
|
2023-08-04 09:04:14 +02:00
|
|
|
if ( !isActive() ) return;
|
2016-09-28 09:04:21 +02:00
|
|
|
|
2019-11-26 11:35:21 +01:00
|
|
|
for ( RimExtrudedCurveIntersection* cs : m_intersections )
|
2015-11-19 11:41:16 +01:00
|
|
|
{
|
2019-11-12 15:10:41 +01:00
|
|
|
if ( cs->isActive() )
|
2015-11-22 15:07:34 +01:00
|
|
|
{
|
2016-10-25 10:03:55 +02:00
|
|
|
cs->intersectionPartMgr()->applySingleColorEffect();
|
2015-11-22 15:07:34 +01:00
|
|
|
}
|
2015-11-19 11:41:16 +01:00
|
|
|
}
|
2016-09-30 08:40:46 +02:00
|
|
|
|
2019-11-26 13:14:55 +01:00
|
|
|
for ( RimBoxIntersection* cs : m_intersectionBoxes )
|
2016-09-30 08:40:46 +02:00
|
|
|
{
|
2019-11-12 16:58:26 +01:00
|
|
|
if ( cs->isActive() )
|
2016-09-30 08:40:46 +02:00
|
|
|
{
|
|
|
|
|
cs->intersectionBoxPartMgr()->applySingleColorEffect();
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-11-19 11:41:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-19 11:41:16 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-01-18 14:42:33 +01:00
|
|
|
void RimIntersectionCollection::updateCellResultColor( bool hasGeneralCellResult, int timeStepIndex )
|
2015-11-19 11:41:16 +01:00
|
|
|
{
|
2023-08-04 09:04:14 +02:00
|
|
|
if ( !isActive() ) return;
|
2016-09-28 09:04:21 +02:00
|
|
|
|
2019-11-26 11:35:21 +01:00
|
|
|
for ( RimExtrudedCurveIntersection* cs : m_intersections )
|
2015-11-19 11:41:16 +01:00
|
|
|
{
|
2019-11-12 15:10:41 +01:00
|
|
|
if ( cs->isActive() )
|
2015-11-22 15:07:34 +01:00
|
|
|
{
|
2023-02-26 10:48:40 +01:00
|
|
|
bool showResults = cs->activeSeparateResultDefinition() ? cs->activeSeparateResultDefinition()->hasResult() : hasGeneralCellResult;
|
2020-01-21 15:13:29 +01:00
|
|
|
|
|
|
|
|
if ( showResults )
|
2019-11-29 09:29:17 +01:00
|
|
|
{
|
|
|
|
|
cs->intersectionPartMgr()->updateCellResultColor( timeStepIndex, nullptr, nullptr );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cs->intersectionPartMgr()->applySingleColorEffect();
|
|
|
|
|
}
|
2015-11-22 15:07:34 +01:00
|
|
|
}
|
2015-11-19 11:41:16 +01:00
|
|
|
}
|
2016-09-30 08:40:46 +02:00
|
|
|
|
2019-11-26 13:14:55 +01:00
|
|
|
for ( RimBoxIntersection* cs : m_intersectionBoxes )
|
2016-09-30 08:40:46 +02:00
|
|
|
{
|
2019-11-12 16:58:26 +01:00
|
|
|
if ( cs->isActive() )
|
2016-09-30 08:40:46 +02:00
|
|
|
{
|
2023-02-26 10:48:40 +01:00
|
|
|
bool hasSeparateInterResult = cs->activeSeparateResultDefinition() && cs->activeSeparateResultDefinition()->hasResult();
|
2019-11-29 09:29:17 +01:00
|
|
|
if ( hasSeparateInterResult || hasGeneralCellResult )
|
|
|
|
|
{
|
|
|
|
|
cs->intersectionBoxPartMgr()->updateCellResultColor( timeStepIndex );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cs->intersectionBoxPartMgr()->applySingleColorEffect();
|
|
|
|
|
}
|
2016-09-30 08:40:46 +02:00
|
|
|
}
|
|
|
|
|
}
|
2015-11-19 11:41:16 +01:00
|
|
|
}
|
|
|
|
|
|
2020-01-21 15:13:29 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
bool RimIntersectionCollection::hasAnyActiveSeparateResults()
|
|
|
|
|
{
|
2023-08-04 09:04:14 +02:00
|
|
|
if ( !isActive() ) return false;
|
2020-01-21 15:13:29 +01:00
|
|
|
|
|
|
|
|
for ( RimExtrudedCurveIntersection* cs : m_intersections )
|
|
|
|
|
{
|
|
|
|
|
if ( cs->isActive() && cs->activeSeparateResultDefinition() && cs->activeSeparateResultDefinition()->hasResult() )
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( RimBoxIntersection* cs : m_intersectionBoxes )
|
|
|
|
|
{
|
|
|
|
|
if ( cs->isActive() && cs->activeSeparateResultDefinition() && cs->activeSeparateResultDefinition()->hasResult() )
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-19 11:41:16 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-19 11:41:16 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 11:43:15 +01:00
|
|
|
void RimIntersectionCollection::appendPartsToModel( Rim3dView& view, cvf::ModelBasicList* model, cvf::Transform* scaleTransform )
|
2015-11-19 11:41:16 +01:00
|
|
|
{
|
2019-11-12 15:10:41 +01:00
|
|
|
if ( !isActive() ) return;
|
2015-11-19 18:56:23 +01:00
|
|
|
|
2019-11-26 11:35:21 +01:00
|
|
|
for ( RimExtrudedCurveIntersection* cs : m_intersections )
|
2015-11-19 11:41:16 +01:00
|
|
|
{
|
2019-11-12 15:10:41 +01:00
|
|
|
if ( cs->isActive() )
|
2015-11-19 11:41:16 +01:00
|
|
|
{
|
2023-06-05 07:33:04 +02:00
|
|
|
cs->intersectionPartMgr()->appendPolylinePartsToModel( view, model, scaleTransform );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( RimBoxIntersection* cs : m_intersectionBoxes )
|
|
|
|
|
{
|
|
|
|
|
if ( cs->isActive() && cs->show3dManipulator() )
|
|
|
|
|
{
|
|
|
|
|
cs->appendManipulatorPartsToModel( model );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimIntersectionCollection::appendDynamicPartsToModel( cvf::ModelBasicList* model,
|
|
|
|
|
cvf::Transform* scaleTransform,
|
|
|
|
|
size_t timeStepIndex,
|
|
|
|
|
cvf::UByteArray* visibleCells )
|
|
|
|
|
{
|
|
|
|
|
if ( !isActive() ) return;
|
|
|
|
|
|
|
|
|
|
for ( RimExtrudedCurveIntersection* cs : m_intersections )
|
|
|
|
|
{
|
|
|
|
|
if ( cs->isActive() )
|
|
|
|
|
{
|
|
|
|
|
cs->intersectionPartMgr()->generatePartGeometry( visibleCells );
|
2020-01-14 12:36:38 +01:00
|
|
|
cs->intersectionPartMgr()->appendIntersectionFacesToModel( model, scaleTransform );
|
2019-09-06 10:40:57 +02:00
|
|
|
cs->intersectionPartMgr()->appendMeshLinePartsToModel( model, scaleTransform );
|
2015-11-19 11:41:16 +01:00
|
|
|
}
|
|
|
|
|
}
|
2016-09-30 08:40:46 +02:00
|
|
|
|
2019-11-26 13:14:55 +01:00
|
|
|
for ( RimBoxIntersection* cs : m_intersectionBoxes )
|
2016-09-30 08:40:46 +02:00
|
|
|
{
|
2019-11-12 15:10:41 +01:00
|
|
|
if ( cs->isActive() )
|
2016-09-30 08:40:46 +02:00
|
|
|
{
|
2023-06-05 07:33:04 +02:00
|
|
|
cs->intersectionBoxPartMgr()->generatePartGeometry( visibleCells );
|
2019-11-26 12:30:44 +01:00
|
|
|
cs->intersectionBoxPartMgr()->appendNativeIntersectionFacesToModel( model, scaleTransform );
|
2019-09-06 10:40:57 +02:00
|
|
|
cs->intersectionBoxPartMgr()->appendMeshLinePartsToModel( model, scaleTransform );
|
2016-09-30 08:40:46 +02:00
|
|
|
}
|
|
|
|
|
}
|
2015-11-19 11:41:16 +01:00
|
|
|
}
|
2015-11-19 13:40:45 +01:00
|
|
|
|
2018-11-06 10:09:30 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-11-06 10:09:30 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-06-05 07:33:04 +02:00
|
|
|
void RimIntersectionCollection::clearGeometry()
|
2018-11-06 10:09:30 +01:00
|
|
|
{
|
2019-11-26 11:35:21 +01:00
|
|
|
for ( RimExtrudedCurveIntersection* intersection : m_intersections )
|
2018-11-06 10:09:30 +01:00
|
|
|
{
|
2023-06-05 07:33:04 +02:00
|
|
|
intersection->clearGeometry();
|
2018-11-06 10:09:30 +01:00
|
|
|
}
|
|
|
|
|
|
2019-11-26 13:14:55 +01:00
|
|
|
for ( RimBoxIntersection* intersectionBox : m_intersectionBoxes )
|
2018-11-06 10:09:30 +01:00
|
|
|
{
|
2023-06-05 07:33:04 +02:00
|
|
|
intersectionBox->clearGeometry();
|
2018-11-06 10:09:30 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-05 13:23:44 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-02-05 13:23:44 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-26 11:35:21 +01:00
|
|
|
std::vector<RimExtrudedCurveIntersection*> RimIntersectionCollection::intersections() const
|
2018-02-05 13:23:44 +01:00
|
|
|
{
|
2023-05-12 21:41:34 +02:00
|
|
|
return m_intersections.childrenByType();
|
2018-02-05 13:23:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-02-05 13:23:44 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-26 13:14:55 +01:00
|
|
|
std::vector<RimBoxIntersection*> RimIntersectionCollection::intersectionBoxes() const
|
2018-02-05 13:23:44 +01:00
|
|
|
{
|
2023-05-12 21:41:34 +02:00
|
|
|
return m_intersectionBoxes.childrenByType();
|
2018-02-05 13:23:44 +01:00
|
|
|
}
|
|
|
|
|
|
2018-03-02 11:25:47 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-03-02 11:25:47 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimIntersectionCollection::recomputeSimWellBranchData()
|
|
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
for ( const auto& intersection : intersections() )
|
2018-03-02 11:25:47 +01:00
|
|
|
{
|
|
|
|
|
intersection->recomputeSimulationWellBranchData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-19 13:40:45 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-19 13:40:45 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-02-26 10:48:40 +01:00
|
|
|
void RimIntersectionCollection::appendIntersectionAndUpdate( RimExtrudedCurveIntersection* intersection, bool allowActiveViewChange )
|
2015-11-19 13:40:45 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
m_intersections.push_back( intersection );
|
2015-11-19 13:40:45 +01:00
|
|
|
|
2022-01-16 23:56:00 +01:00
|
|
|
intersection->setDepthOverride( m_depthThresholdOverridden );
|
|
|
|
|
intersection->setDepthOverrideParameters( m_depthUpperThreshold, m_depthLowerThreshold, m_depthFilterType() );
|
2022-01-05 15:52:04 +01:00
|
|
|
|
2018-01-23 14:23:28 +01:00
|
|
|
syncronize2dIntersectionViews();
|
|
|
|
|
|
2015-11-19 13:40:45 +01:00
|
|
|
updateConnectedEditors();
|
2019-10-24 12:46:07 +02:00
|
|
|
Riu3DMainWindowTools::selectAsCurrentItem( intersection, allowActiveViewChange );
|
2015-11-19 13:40:45 +01:00
|
|
|
|
2022-01-16 23:56:00 +01:00
|
|
|
rebuild3dView();
|
2015-11-19 13:40:45 +01:00
|
|
|
}
|
2015-11-19 18:56:23 +01:00
|
|
|
|
2018-01-24 11:30:39 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-01-24 11:30:39 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-26 11:35:21 +01:00
|
|
|
void RimIntersectionCollection::appendIntersectionNoUpdate( RimExtrudedCurveIntersection* intersection )
|
2018-01-24 11:30:39 +01:00
|
|
|
{
|
2022-01-16 23:56:00 +01:00
|
|
|
intersection->setDepthOverride( m_depthThresholdOverridden );
|
|
|
|
|
intersection->setDepthOverrideParameters( m_depthUpperThreshold, m_depthLowerThreshold, m_depthFilterType() );
|
2019-09-06 10:40:57 +02:00
|
|
|
m_intersections.push_back( intersection );
|
2018-01-24 11:30:39 +01:00
|
|
|
}
|
|
|
|
|
|
2018-01-23 14:23:28 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-01-23 14:23:28 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimIntersectionCollection::syncronize2dIntersectionViews()
|
|
|
|
|
{
|
2023-05-12 21:41:34 +02:00
|
|
|
auto ownerCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
|
2019-09-06 10:40:57 +02:00
|
|
|
ownerCase->intersectionViewCollection()->syncFromExistingIntersections( true );
|
2018-01-23 14:23:28 +01:00
|
|
|
}
|
|
|
|
|
|
2018-02-01 17:45:22 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-02-01 17:45:22 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimIntersectionCollection::scheduleCreateDisplayModelAndRedraw2dIntersectionViews()
|
|
|
|
|
{
|
2019-11-26 11:35:21 +01:00
|
|
|
for ( RimExtrudedCurveIntersection* isection : m_intersections )
|
2018-02-01 17:45:22 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( isection->correspondingIntersectionView() )
|
2018-10-23 16:32:40 +02:00
|
|
|
{
|
|
|
|
|
isection->correspondingIntersectionView()->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
|
}
|
2018-02-01 17:45:22 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-30 08:40:46 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2016-09-30 08:40:46 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-26 13:14:55 +01:00
|
|
|
void RimIntersectionCollection::appendIntersectionBoxAndUpdate( RimBoxIntersection* intersectionBox )
|
2016-09-30 08:40:46 +02:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
m_intersectionBoxes.push_back( intersectionBox );
|
2018-01-24 10:48:23 +01:00
|
|
|
|
|
|
|
|
updateConnectedEditors();
|
2019-10-17 16:39:24 +02:00
|
|
|
Riu3DMainWindowTools::selectAsCurrentItem( intersectionBox, false );
|
2018-01-24 10:48:23 +01:00
|
|
|
|
2022-01-16 23:56:00 +01:00
|
|
|
rebuild3dView();
|
2016-09-30 08:40:46 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-24 11:30:39 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2018-01-24 11:30:39 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-26 13:14:55 +01:00
|
|
|
void RimIntersectionCollection::appendIntersectionBoxNoUpdate( RimBoxIntersection* intersectionBox )
|
2018-01-24 11:30:39 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
m_intersectionBoxes.push_back( intersectionBox );
|
2018-01-24 11:30:39 +01:00
|
|
|
}
|
|
|
|
|
|
2015-11-19 18:56:23 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-19 18:56:23 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-02-26 10:48:40 +01:00
|
|
|
void RimIntersectionCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
2015-11-19 18:56:23 +01:00
|
|
|
{
|
2022-01-16 23:56:00 +01:00
|
|
|
bool rebuildView = false;
|
|
|
|
|
|
2023-06-05 07:33:04 +02:00
|
|
|
if ( changedField == &m_isActive )
|
2015-11-19 18:56:23 +01:00
|
|
|
{
|
2019-05-06 10:36:05 +02:00
|
|
|
updateUiIconFromToggleField();
|
2022-01-16 23:56:00 +01:00
|
|
|
rebuildView = true;
|
2022-01-05 15:52:04 +01:00
|
|
|
}
|
2023-06-05 07:33:04 +02:00
|
|
|
else if ( changedField == &m_depthThresholdOverridden )
|
2022-01-05 15:52:04 +01:00
|
|
|
{
|
|
|
|
|
for ( RimExtrudedCurveIntersection* cs : m_intersections )
|
|
|
|
|
{
|
2022-01-16 23:56:00 +01:00
|
|
|
cs->setDepthOverride( m_depthThresholdOverridden );
|
|
|
|
|
if ( m_depthThresholdOverridden() )
|
|
|
|
|
{
|
|
|
|
|
cs->setDepthOverrideParameters( m_depthUpperThreshold, m_depthLowerThreshold, m_depthFilterType() );
|
|
|
|
|
}
|
2022-01-10 21:57:14 +01:00
|
|
|
cs->rebuildGeometryAndScheduleCreateDisplayModel();
|
2022-01-05 15:52:04 +01:00
|
|
|
}
|
2022-01-16 23:56:00 +01:00
|
|
|
rebuildView = true;
|
|
|
|
|
}
|
2023-06-05 07:33:04 +02:00
|
|
|
else if ( ( changedField == &m_depthUpperThreshold ) || ( changedField == &m_depthLowerThreshold ) ||
|
|
|
|
|
( changedField == &m_depthFilterType ) )
|
2022-01-16 23:56:00 +01:00
|
|
|
{
|
|
|
|
|
for ( RimExtrudedCurveIntersection* cs : m_intersections )
|
2015-11-19 18:56:23 +01:00
|
|
|
{
|
2022-01-16 23:56:00 +01:00
|
|
|
cs->setDepthOverrideParameters( m_depthUpperThreshold, m_depthLowerThreshold, m_depthFilterType() );
|
|
|
|
|
cs->rebuildGeometryAndScheduleCreateDisplayModel();
|
2015-11-19 18:56:23 +01:00
|
|
|
}
|
2022-01-16 23:56:00 +01:00
|
|
|
rebuildView = true;
|
|
|
|
|
}
|
2023-06-05 07:33:04 +02:00
|
|
|
else if ( changedField == &m_kFilterOverridden || changedField == &m_kFilterStr )
|
2023-05-25 08:14:43 +02:00
|
|
|
{
|
|
|
|
|
for ( RimExtrudedCurveIntersection* cs : m_intersections )
|
|
|
|
|
{
|
|
|
|
|
cs->setKFilterOverride( m_kFilterOverridden, m_kFilterStr );
|
|
|
|
|
cs->rebuildGeometryAndScheduleCreateDisplayModel();
|
|
|
|
|
}
|
|
|
|
|
rebuildView = true;
|
|
|
|
|
}
|
2023-06-05 07:33:04 +02:00
|
|
|
else if ( changedField == &m_applyCellFilters )
|
|
|
|
|
{
|
|
|
|
|
rebuildView = true;
|
|
|
|
|
}
|
2023-05-25 08:14:43 +02:00
|
|
|
|
2022-01-16 23:56:00 +01:00
|
|
|
if ( rebuildView )
|
|
|
|
|
{
|
|
|
|
|
rebuild3dView();
|
2015-11-19 18:56:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
2016-07-27 08:05:44 +02:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-05-18 16:02:27 +02:00
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-02-26 10:48:40 +01:00
|
|
|
void RimIntersectionCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects )
|
2020-05-18 16:02:27 +02:00
|
|
|
{
|
|
|
|
|
syncronize2dIntersectionViews();
|
2022-01-16 23:56:00 +01:00
|
|
|
rebuild3dView();
|
2020-05-18 16:02:27 +02:00
|
|
|
}
|
|
|
|
|
|
2022-02-07 18:38:19 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimIntersectionCollection::onChildAdded( caf::PdmFieldHandle* containerForNewObject )
|
|
|
|
|
{
|
|
|
|
|
syncronize2dIntersectionViews();
|
|
|
|
|
rebuild3dView();
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-18 16:02:27 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2016-07-27 08:05:44 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
bool RimIntersectionCollection::hasActiveIntersectionForSimulationWell( const RimSimWellInView* simWell ) const
|
2016-07-27 08:05:44 +02:00
|
|
|
{
|
2019-11-12 15:10:41 +01:00
|
|
|
if ( !isActive() ) return false;
|
2016-07-27 08:05:44 +02:00
|
|
|
|
2019-11-26 11:35:21 +01:00
|
|
|
for ( RimExtrudedCurveIntersection* cs : m_intersections )
|
2016-07-27 08:05:44 +02:00
|
|
|
{
|
2021-08-26 08:13:03 +02:00
|
|
|
if ( cs->isActive() && cs->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_SIMULATION_WELL &&
|
2019-11-26 13:56:02 +01:00
|
|
|
cs->simulationWell() == simWell )
|
2016-07-27 08:05:44 +02:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-10-25 09:50:33 +02:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2016-10-25 09:50:33 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimIntersectionCollection::updateIntersectionBoxGeometry()
|
|
|
|
|
{
|
2019-11-26 13:14:55 +01:00
|
|
|
for ( RimBoxIntersection* intersectionBox : m_intersectionBoxes )
|
2016-10-25 09:50:33 +02:00
|
|
|
{
|
|
|
|
|
intersectionBox->updateBoxManipulatorGeometry();
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-05 15:52:04 +01:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimIntersectionCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
|
|
|
|
{
|
2023-06-05 07:33:04 +02:00
|
|
|
caf::PdmUiGroup* genGroup = uiOrdering.addNewGroup( "General" );
|
|
|
|
|
genGroup->add( &m_applyCellFilters );
|
|
|
|
|
|
2023-05-25 08:14:43 +02:00
|
|
|
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup( "Depth Filter - Curve Intersections" );
|
2023-06-05 07:33:04 +02:00
|
|
|
filterGroup->setCollapsedByDefault();
|
2023-05-25 08:14:43 +02:00
|
|
|
|
|
|
|
|
m_depthFilterType.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() );
|
|
|
|
|
m_depthUpperThreshold.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() );
|
|
|
|
|
m_depthLowerThreshold.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() );
|
|
|
|
|
|
|
|
|
|
filterGroup->add( &m_depthThresholdOverridden );
|
|
|
|
|
filterGroup->add( &m_depthFilterType );
|
|
|
|
|
|
|
|
|
|
switch ( m_depthFilterType() )
|
|
|
|
|
{
|
|
|
|
|
case RimIntersectionFilterEnum::INTERSECT_FILTER_BELOW:
|
|
|
|
|
m_depthUpperThreshold.uiCapability()->setUiName( "Depth" );
|
|
|
|
|
filterGroup->add( &m_depthUpperThreshold );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN:
|
|
|
|
|
m_depthUpperThreshold.uiCapability()->setUiName( "Upper Depth" );
|
|
|
|
|
filterGroup->add( &m_depthUpperThreshold );
|
|
|
|
|
m_depthLowerThreshold.uiCapability()->setUiName( "Lower Depth" );
|
|
|
|
|
filterGroup->add( &m_depthLowerThreshold );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case RimIntersectionFilterEnum::INTERSECT_FILTER_ABOVE:
|
|
|
|
|
m_depthLowerThreshold.uiCapability()->setUiName( "Depth" );
|
|
|
|
|
filterGroup->add( &m_depthLowerThreshold );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case RimIntersectionFilterEnum::INTERSECT_FILTER_NONE:
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-01-05 15:52:04 +01:00
|
|
|
if ( eclipseView() )
|
|
|
|
|
{
|
2023-06-05 07:33:04 +02:00
|
|
|
caf::PdmUiGroup* kfilterGroup = uiOrdering.addNewGroup( "K Filter - Curve Intersections" );
|
|
|
|
|
kfilterGroup->setCollapsedByDefault();
|
2022-01-05 15:52:04 +01:00
|
|
|
|
2023-05-25 08:14:43 +02:00
|
|
|
m_kFilterStr.uiCapability()->setUiReadOnly( !m_kFilterOverridden() );
|
2022-01-16 23:56:00 +01:00
|
|
|
|
2023-06-05 07:33:04 +02:00
|
|
|
kfilterGroup->add( &m_kFilterOverridden );
|
|
|
|
|
kfilterGroup->add( &m_kFilterStr );
|
2022-01-05 15:52:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uiOrdering.skipRemainingFields( true );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-02-26 10:48:40 +01:00
|
|
|
void RimIntersectionCollection::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
2022-01-05 15:52:04 +01:00
|
|
|
{
|
|
|
|
|
auto* doubleSliderAttrib = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute );
|
|
|
|
|
if ( doubleSliderAttrib )
|
|
|
|
|
{
|
2022-01-16 23:56:00 +01:00
|
|
|
if ( ( field == &m_depthUpperThreshold ) || ( field == &m_depthLowerThreshold ) )
|
2022-01-05 15:52:04 +01:00
|
|
|
{
|
|
|
|
|
RimEclipseView* eclView = eclipseView();
|
|
|
|
|
|
|
|
|
|
if ( eclView )
|
|
|
|
|
{
|
|
|
|
|
const cvf::BoundingBox bb = eclView->mainGrid()->boundingBox();
|
|
|
|
|
|
|
|
|
|
doubleSliderAttrib->m_minimum = -1.0 * bb.max().z();
|
|
|
|
|
doubleSliderAttrib->m_maximum = -1.0 * bb.min().z();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2023-06-08 09:13:22 +02:00
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimIntersectionCollection::initAfterRead()
|
|
|
|
|
{
|
|
|
|
|
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2023.03.0" ) )
|
|
|
|
|
{
|
|
|
|
|
m_applyCellFilters = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2022-01-05 15:52:04 +01:00
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimEclipseView* RimIntersectionCollection::eclipseView() const
|
|
|
|
|
{
|
2023-05-12 21:41:34 +02:00
|
|
|
return firstAncestorOrThisOfType<RimEclipseView>();
|
2022-01-05 15:52:04 +01:00
|
|
|
}
|
2022-01-16 23:56:00 +01:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimIntersectionCollection::rebuild3dView() const
|
|
|
|
|
{
|
2023-05-12 21:41:34 +02:00
|
|
|
auto rimView = firstAncestorOrThisOfType<Rim3dView>();
|
2022-01-16 23:56:00 +01:00
|
|
|
if ( rimView )
|
|
|
|
|
{
|
|
|
|
|
rimView->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-05 07:33:04 +02:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
bool RimIntersectionCollection::shouldApplyCellFiltersToIntersections() const
|
|
|
|
|
{
|
|
|
|
|
return m_applyCellFilters();
|
|
|
|
|
}
|