2016-09-20 05:03:26 -05:00
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil 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.
//
/////////////////////////////////////////////////////////////////////////////////
# include "RimIntersectionBox.h"
# include "RimView.h"
2016-09-21 07:40:50 -05:00
# include "RivIntersectionBoxPartMgr.h"
2016-09-20 05:03:26 -05:00
# include "cafPdmUiSliderEditor.h"
2016-09-22 03:38:57 -05:00
# include "RimCase.h"
2016-09-23 09:12:19 -05:00
# include "cafPdmUiDoubleSliderEditor.h"
2016-09-28 05:39:43 -05:00
# include "RimEclipseView.h"
2016-09-20 05:03:26 -05:00
2016-09-23 04:37:33 -05:00
namespace caf
{
template < >
void AppEnum < RimIntersectionBox : : SinglePlaneState > : : setUp ( )
{
addItem ( RimIntersectionBox : : PLANE_STATE_NONE , " PLANE_STATE_NONE " , " None " ) ;
addItem ( RimIntersectionBox : : PLANE_STATE_X , " PLANE_STATE_X " , " X Plane " ) ;
addItem ( RimIntersectionBox : : PLANE_STATE_Y , " PLANE_STATE_Y " , " Y Plane " ) ;
addItem ( RimIntersectionBox : : PLANE_STATE_Z , " PLANE_STATE_Z " , " Z Plane " ) ;
setDefault ( RimIntersectionBox : : PLANE_STATE_NONE ) ;
}
}
2016-09-20 05:03:26 -05:00
CAF_PDM_SOURCE_INIT ( RimIntersectionBox , " IntersectionBox " ) ;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionBox : : RimIntersectionBox ( )
{
CAF_PDM_InitObject ( " Intersection Box " , " :/IntersectionBox16x16.png " , " " , " " ) ;
CAF_PDM_InitField ( & name , " UserDescription " , QString ( " Intersection Name " ) , " Name " , " " , " " , " " ) ;
CAF_PDM_InitField ( & isActive , " Active " , true , " Active " , " " , " " , " " ) ;
isActive . uiCapability ( ) - > setUiHidden ( true ) ;
2016-09-27 04:28:39 -05:00
CAF_PDM_InitField ( & m_singlePlaneState , " singlePlaneState " , caf : : AppEnum < SinglePlaneState > ( SinglePlaneState : : PLANE_STATE_NONE ) , " Collapse box to plane " , " " , " " , " " ) ;
2016-09-23 04:37:33 -05:00
2016-09-29 06:32:33 -05:00
CAF_PDM_InitField ( & m_minXCoord , " MinXCoord " , 0.0 , " Min " , " " , " " , " " ) ;
2016-09-27 04:28:39 -05:00
m_minXCoord . uiCapability ( ) - > setUiEditorTypeName ( caf : : PdmUiDoubleSliderEditor : : uiEditorTypeName ( ) ) ;
2016-09-20 05:03:26 -05:00
2016-09-29 06:32:33 -05:00
CAF_PDM_InitField ( & m_maxXCoord , " MaxXCoord " , 0.0 , " Max " , " " , " " , " " ) ;
2016-09-27 04:28:39 -05:00
m_maxXCoord . uiCapability ( ) - > setUiEditorTypeName ( caf : : PdmUiDoubleSliderEditor : : uiEditorTypeName ( ) ) ;
2016-09-20 05:03:26 -05:00
2016-09-29 06:32:33 -05:00
CAF_PDM_InitField ( & m_minYCoord , " MinYCoord " , 0.0 , " Min " , " " , " " , " " ) ;
2016-09-27 04:28:39 -05:00
m_minYCoord . uiCapability ( ) - > setUiEditorTypeName ( caf : : PdmUiDoubleSliderEditor : : uiEditorTypeName ( ) ) ;
2016-09-20 05:03:26 -05:00
2016-09-29 06:32:33 -05:00
CAF_PDM_InitField ( & m_maxYCoord , " MaxYCoord " , 0.0 , " Max " , " " , " " , " " ) ;
2016-09-27 04:28:39 -05:00
m_maxYCoord . uiCapability ( ) - > setUiEditorTypeName ( caf : : PdmUiDoubleSliderEditor : : uiEditorTypeName ( ) ) ;
2016-09-20 05:03:26 -05:00
2016-09-29 07:21:22 -05:00
CAF_PDM_InitField ( & m_minDepth , " MinDepth " , 0.0 , " Min " , " " , " " , " " ) ;
m_minDepth . uiCapability ( ) - > setUiEditorTypeName ( caf : : PdmUiDoubleSliderEditor : : uiEditorTypeName ( ) ) ;
2016-09-20 05:03:26 -05:00
2016-09-29 07:21:22 -05:00
CAF_PDM_InitField ( & m_maxDepth , " MaxDepth " , 0.0 , " Max " , " " , " " , " " ) ;
m_maxDepth . uiCapability ( ) - > setUiEditorTypeName ( caf : : PdmUiDoubleSliderEditor : : uiEditorTypeName ( ) ) ;
2016-09-29 07:57:27 -05:00
CAF_PDM_InitField ( & showInactiveCells , " ShowInactiveCells " , false , " Inactive Cells " , " " , " " , " " ) ;
2016-09-20 05:03:26 -05:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionBox : : ~ RimIntersectionBox ( )
{
}
2016-09-21 07:21:45 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf : : Mat4d RimIntersectionBox : : boxOrigin ( ) const
{
cvf : : Mat4d mx ( cvf : : Mat4d : : IDENTITY ) ;
2016-09-29 07:21:22 -05:00
mx . setTranslation ( cvf : : Vec3d ( m_minXCoord , m_minYCoord , - m_maxDepth ) ) ;
2016-09-21 07:21:45 -05:00
return mx ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf : : Vec3d RimIntersectionBox : : boxSize ( ) const
{
2016-09-29 07:21:22 -05:00
return cvf : : Vec3d ( m_maxXCoord , m_maxYCoord , m_maxDepth ) - cvf : : Vec3d ( m_minXCoord , m_minYCoord , m_minDepth ) ;
2016-09-27 04:28:39 -05:00
}
2016-09-29 04:43:47 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox : : setFromOriginAndSize ( const cvf : : Vec3d & origin , const cvf : : Vec3d & size )
{
2016-09-30 03:28:43 -05:00
m_minXCoord = origin . x ( ) ;
m_minYCoord = origin . y ( ) ;
m_minDepth = - ( origin . z ( ) + size . z ( ) ) ;
2016-09-29 04:43:47 -05:00
2016-09-30 03:28:43 -05:00
m_maxXCoord = origin . x ( ) + size . x ( ) ;
m_maxYCoord = origin . y ( ) + size . y ( ) ;
m_maxDepth = - origin . z ( ) ;
2016-09-29 04:43:47 -05:00
updateConnectedEditors ( ) ;
rebuildGeometryAndScheduleCreateDisplayModel ( ) ;
}
2016-09-27 04:28:39 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimIntersectionBox : : SinglePlaneState RimIntersectionBox : : singlePlaneState ( ) const
{
return m_singlePlaneState ( ) ;
2016-09-21 07:21:45 -05:00
}
2016-09-20 05:03:26 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2016-09-28 05:39:43 -05:00
void RimIntersectionBox : : setToDefaultSizeBox ( )
2016-09-20 05:03:26 -05:00
{
2016-09-28 05:39:43 -05:00
cvf : : BoundingBox boundingBox = currentCellBoundingBox ( ) ;
cvf : : Vec3d center = boundingBox . center ( ) ;
double defaultWidthFactor = 0.5 ;
2016-09-29 07:57:27 -05:00
m_minXCoord = center . x ( ) - 0.5 * boundingBox . extent ( ) . x ( ) * defaultWidthFactor ;
m_minYCoord = center . y ( ) - 0.5 * boundingBox . extent ( ) . y ( ) * defaultWidthFactor ;
m_minDepth = - ( center . z ( ) + 0.5 * boundingBox . extent ( ) . z ( ) * defaultWidthFactor ) ;
m_maxXCoord = center . x ( ) + 0.5 * boundingBox . extent ( ) . x ( ) * defaultWidthFactor ;
m_maxYCoord = center . y ( ) + 0.5 * boundingBox . extent ( ) . y ( ) * defaultWidthFactor ;
m_maxDepth = - ( center . z ( ) - 0.5 * boundingBox . extent ( ) . z ( ) * defaultWidthFactor ) ;
2016-09-28 05:39:43 -05:00
2016-09-20 05:03:26 -05:00
}
2016-09-23 09:12:19 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2016-09-28 05:39:43 -05:00
void RimIntersectionBox : : setToDefaultSizeSlice ( SinglePlaneState plane , const cvf : : Vec3d & position )
2016-09-23 09:12:19 -05:00
{
2016-09-28 05:39:43 -05:00
m_singlePlaneState = plane ;
2016-09-23 09:17:53 -05:00
2016-09-28 05:39:43 -05:00
cvf : : BoundingBox boundingBox = currentCellBoundingBox ( ) ;
cvf : : Vec3d center = position ;
if ( center . isUndefined ( ) ) center = boundingBox . center ( ) ;
2016-09-23 09:12:19 -05:00
2016-09-28 05:39:43 -05:00
double defaultWidthFactor = 0.5 ;
2016-09-23 09:17:53 -05:00
2016-09-29 07:57:27 -05:00
m_minXCoord = center [ 0 ] - 0.5 * boundingBox . extent ( ) . x ( ) * defaultWidthFactor ;
m_minYCoord = center [ 1 ] - 0.5 * boundingBox . extent ( ) . y ( ) * defaultWidthFactor ;
m_minDepth = - ( center [ 2 ] + 0.5 * boundingBox . extent ( ) . z ( ) * defaultWidthFactor ) ;
m_maxXCoord = center [ 0 ] + 0.5 * boundingBox . extent ( ) . x ( ) * defaultWidthFactor ;
m_maxYCoord = center [ 1 ] + 0.5 * boundingBox . extent ( ) . y ( ) * defaultWidthFactor ;
m_maxDepth = - ( center [ 2 ] - 0.5 * boundingBox . extent ( ) . z ( ) * defaultWidthFactor ) ;
2016-09-23 09:12:19 -05:00
2016-09-28 05:39:43 -05:00
switch ( plane )
{
case PLANE_STATE_X : m_minXCoord = m_maxXCoord = center [ 0 ] ; break ;
case PLANE_STATE_Y : m_minYCoord = m_maxYCoord = center [ 1 ] ; break ;
2016-09-29 08:41:49 -05:00
case PLANE_STATE_Z : m_minDepth = m_maxDepth = - center [ 2 ] ; break ;
2016-09-28 05:39:43 -05:00
}
2016-09-23 09:17:53 -05:00
updateVisibility ( ) ;
2016-09-23 09:12:19 -05:00
}
2016-09-20 05:03:26 -05:00
2016-09-28 05:39:43 -05:00
2016-09-21 07:40:50 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivIntersectionBoxPartMgr * RimIntersectionBox : : intersectionBoxPartMgr ( )
{
if ( m_intersectionBoxPartMgr . isNull ( ) ) m_intersectionBoxPartMgr = new RivIntersectionBoxPartMgr ( this ) ;
return m_intersectionBoxPartMgr . p ( ) ;
}
2016-09-20 05:03:26 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox : : fieldChangedByUi ( const caf : : PdmFieldHandle * changedField , const QVariant & oldValue , const QVariant & newValue )
{
2016-09-27 04:28:39 -05:00
if ( changedField = = & m_singlePlaneState )
2016-09-23 04:37:33 -05:00
{
2016-09-29 03:02:12 -05:00
switchSingelPlaneState ( ) ;
2016-09-23 04:37:33 -05:00
updateVisibility ( ) ;
}
2016-09-27 04:28:39 -05:00
else if ( changedField = = & m_minXCoord )
2016-09-23 04:37:33 -05:00
{
clampSinglePlaneValues ( ) ;
2016-09-27 04:28:39 -05:00
m_minXCoord = CVF_MIN ( m_maxXCoord , m_minXCoord ) ;
2016-09-23 04:37:33 -05:00
}
2016-09-27 04:28:39 -05:00
else if ( changedField = = & m_minYCoord )
2016-09-23 04:37:33 -05:00
{
clampSinglePlaneValues ( ) ;
2016-09-27 04:28:39 -05:00
m_minYCoord = CVF_MIN ( m_maxYCoord , m_minYCoord ) ;
2016-09-23 04:37:33 -05:00
}
2016-09-29 07:21:22 -05:00
else if ( changedField = = & m_minDepth )
2016-09-23 04:37:33 -05:00
{
clampSinglePlaneValues ( ) ;
2016-09-29 07:21:22 -05:00
m_minDepth = CVF_MIN ( m_maxDepth , m_minDepth ) ;
2016-09-23 04:37:33 -05:00
}
2016-09-27 04:28:39 -05:00
else if ( changedField = = & m_maxXCoord )
2016-09-23 04:37:33 -05:00
{
2016-09-27 04:28:39 -05:00
m_maxXCoord = CVF_MAX ( m_maxXCoord , m_minXCoord ) ;
2016-09-23 04:37:33 -05:00
}
2016-09-27 04:28:39 -05:00
else if ( changedField = = & m_maxYCoord )
2016-09-23 04:37:33 -05:00
{
2016-09-27 04:28:39 -05:00
m_maxYCoord = CVF_MAX ( m_maxYCoord , m_minYCoord ) ;
2016-09-23 04:37:33 -05:00
}
2016-09-29 07:21:22 -05:00
else if ( changedField = = & m_maxDepth )
2016-09-23 04:37:33 -05:00
{
2016-09-29 07:21:22 -05:00
m_maxDepth = CVF_MAX ( m_maxDepth , m_minDepth ) ;
2016-09-23 04:37:33 -05:00
}
2016-09-22 07:54:46 -05:00
if ( changedField ! = & name )
2016-09-20 05:03:26 -05:00
{
rebuildGeometryAndScheduleCreateDisplayModel ( ) ;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox : : defineEditorAttribute ( const caf : : PdmFieldHandle * field , QString uiConfigName , caf : : PdmUiEditorAttribute * attribute )
{
2016-09-23 09:12:19 -05:00
caf : : PdmUiDoubleSliderEditorAttribute * myAttr = static_cast < caf : : PdmUiDoubleSliderEditorAttribute * > ( attribute ) ;
2016-09-20 05:03:26 -05:00
if ( myAttr )
{
2016-09-28 05:39:43 -05:00
cvf : : BoundingBox cellsBoundingBox = currentCellBoundingBox ( ) ;
2016-09-27 04:28:39 -05:00
if ( field = = & m_minXCoord | | field = = & m_maxXCoord )
2016-09-20 05:03:26 -05:00
{
2016-09-28 05:39:43 -05:00
myAttr - > m_minimum = cellsBoundingBox . min ( ) . x ( ) ;
myAttr - > m_maximum = cellsBoundingBox . max ( ) . x ( ) ;
2016-09-20 05:03:26 -05:00
}
2016-09-27 04:28:39 -05:00
else if ( field = = & m_minYCoord | | field = = & m_maxYCoord )
2016-09-20 05:03:26 -05:00
{
2016-09-28 05:39:43 -05:00
myAttr - > m_minimum = cellsBoundingBox . min ( ) . y ( ) ;
myAttr - > m_maximum = cellsBoundingBox . max ( ) . y ( ) ;
2016-09-20 05:03:26 -05:00
}
2016-09-29 07:21:22 -05:00
else if ( field = = & m_minDepth | | field = = & m_maxDepth )
2016-09-20 05:03:26 -05:00
{
2016-09-29 07:21:22 -05:00
myAttr - > m_minimum = - cellsBoundingBox . max ( ) . z ( ) ;
myAttr - > m_maximum = - cellsBoundingBox . min ( ) . z ( ) ;
2016-09-20 05:03:26 -05:00
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox : : defineUiOrdering ( QString uiConfigName , caf : : PdmUiOrdering & uiOrdering )
{
uiOrdering . add ( & name ) ;
2016-09-27 04:28:39 -05:00
uiOrdering . add ( & m_singlePlaneState ) ;
2016-09-20 05:03:26 -05:00
2016-09-29 06:32:33 -05:00
cvf : : BoundingBox cellsBoundingBox = currentCellBoundingBox ( ) ;
2016-09-22 03:38:57 -05:00
{
2016-09-29 06:32:33 -05:00
caf : : PdmUiGroup * group = uiOrdering . addNewGroup ( " X Coordinates " + QString ( " [%1 %2] " ) . arg ( cellsBoundingBox . min ( ) . x ( ) ) . arg ( cellsBoundingBox . max ( ) . x ( ) ) ) ;
2016-09-27 04:28:39 -05:00
group - > add ( & m_minXCoord ) ;
group - > add ( & m_maxXCoord ) ;
2016-09-22 03:38:57 -05:00
}
2016-09-20 05:03:26 -05:00
2016-09-22 03:38:57 -05:00
{
2016-09-29 06:32:33 -05:00
caf : : PdmUiGroup * group = uiOrdering . addNewGroup ( " Y Coordinates " + QString ( " [%1 %2] " ) . arg ( cellsBoundingBox . min ( ) . y ( ) ) . arg ( cellsBoundingBox . max ( ) . y ( ) ) ) ;
2016-09-27 04:28:39 -05:00
group - > add ( & m_minYCoord ) ;
group - > add ( & m_maxYCoord ) ;
2016-09-22 03:38:57 -05:00
}
{
2016-09-29 07:21:22 -05:00
caf : : PdmUiGroup * group = uiOrdering . addNewGroup ( " Depth " + QString ( " [%1 %2] " ) . arg ( - cellsBoundingBox . max ( ) . z ( ) ) . arg ( - cellsBoundingBox . min ( ) . z ( ) ) ) ;
group - > add ( & m_minDepth ) ;
group - > add ( & m_maxDepth ) ;
2016-09-22 03:38:57 -05:00
}
2016-09-28 05:39:43 -05:00
2016-09-20 05:03:26 -05:00
}
2016-09-29 06:32:33 -05:00
2016-09-23 04:37:33 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox : : initAfterRead ( )
{
updateVisibility ( ) ;
}
2016-09-20 05:03:26 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf : : PdmFieldHandle * RimIntersectionBox : : userDescriptionField ( )
{
return & name ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf : : PdmFieldHandle * RimIntersectionBox : : objectToggleField ( )
{
return & isActive ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox : : rebuildGeometryAndScheduleCreateDisplayModel ( )
{
2016-09-21 07:40:50 -05:00
m_intersectionBoxPartMgr = nullptr ;
2016-09-20 05:03:26 -05:00
RimView * rimView = NULL ;
2016-09-28 07:35:57 -05:00
this - > firstAncestorOrThisOfType ( rimView ) ;
2016-09-20 05:03:26 -05:00
if ( rimView )
{
rimView - > scheduleCreateDisplayModelAndRedraw ( ) ;
}
}
2016-09-23 04:37:33 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox : : updateVisibility ( )
{
2016-09-27 04:28:39 -05:00
m_maxXCoord . uiCapability ( ) - > setUiReadOnly ( false ) ;
m_maxYCoord . uiCapability ( ) - > setUiReadOnly ( false ) ;
2016-09-29 07:21:22 -05:00
m_maxDepth . uiCapability ( ) - > setUiReadOnly ( false ) ;
2016-09-23 04:37:33 -05:00
2016-09-27 04:28:39 -05:00
if ( m_singlePlaneState = = PLANE_STATE_X )
2016-09-23 04:37:33 -05:00
{
2016-09-27 04:28:39 -05:00
m_maxXCoord . uiCapability ( ) - > setUiReadOnly ( true ) ;
2016-09-23 04:37:33 -05:00
}
2016-09-27 04:28:39 -05:00
else if ( m_singlePlaneState = = PLANE_STATE_Y )
2016-09-23 04:37:33 -05:00
{
2016-09-27 04:28:39 -05:00
m_maxYCoord . uiCapability ( ) - > setUiReadOnly ( true ) ;
2016-09-23 04:37:33 -05:00
}
2016-09-27 04:28:39 -05:00
else if ( m_singlePlaneState = = PLANE_STATE_Z )
2016-09-23 04:37:33 -05:00
{
2016-09-29 07:21:22 -05:00
m_maxDepth . uiCapability ( ) - > setUiReadOnly ( true ) ;
2016-09-23 04:37:33 -05:00
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox : : clampSinglePlaneValues ( )
{
2016-09-27 04:28:39 -05:00
if ( m_singlePlaneState = = PLANE_STATE_X )
2016-09-23 04:37:33 -05:00
{
2016-09-29 03:02:12 -05:00
m_maxXCoord = m_minXCoord = 0.5 * ( m_minXCoord + m_maxXCoord ) ;
2016-09-23 04:37:33 -05:00
}
2016-09-27 04:28:39 -05:00
else if ( m_singlePlaneState = = PLANE_STATE_Y )
2016-09-23 04:37:33 -05:00
{
2016-09-29 03:02:12 -05:00
m_maxYCoord = m_minYCoord = 0.5 * ( m_minYCoord + m_maxYCoord ) ;
2016-09-23 04:37:33 -05:00
}
2016-09-27 04:28:39 -05:00
else if ( m_singlePlaneState = = PLANE_STATE_Z )
2016-09-23 04:37:33 -05:00
{
2016-09-29 07:21:22 -05:00
m_maxDepth = m_minDepth = 0.5 * ( m_minDepth + m_maxDepth ) ;
2016-09-23 04:37:33 -05:00
}
}
2016-09-29 03:02:12 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimIntersectionBox : : switchSingelPlaneState ( )
{
cvf : : Vec3d orgSize = boxSize ( ) ;
double orgWidth = orgSize . length ( ) ;
switch ( m_singlePlaneState ( ) ) // New collapsed direction
{
case PLANE_STATE_X :
orgWidth = orgSize [ 0 ] ;
break ;
case PLANE_STATE_Y :
orgWidth = orgSize [ 1 ] ;
break ;
case PLANE_STATE_Z :
orgWidth = orgSize [ 2 ] ;
break ;
case PLANE_STATE_NONE :
orgWidth = orgSize . length ( ) * 0.3 ;
break ;
}
// For the originally collapsed direction, set a new width
if ( m_minXCoord ( ) = = m_maxXCoord ( ) )
{
double center = m_minXCoord ;
m_minXCoord = center - 0.5 * orgWidth ;
m_maxXCoord = center + 0.5 * orgWidth ;
}
if ( m_minYCoord ( ) = = m_maxYCoord ( ) )
{
double center = m_minYCoord ;
m_minYCoord = center - 0.5 * orgWidth ;
m_maxYCoord = center + 0.5 * orgWidth ;
}
2016-09-29 07:21:22 -05:00
if ( m_minDepth ( ) = = m_maxDepth ( ) )
2016-09-29 03:02:12 -05:00
{
2016-09-29 07:21:22 -05:00
double center = m_minDepth ;
m_minDepth = center - 0.5 * orgWidth ;
m_maxDepth = center + 0.5 * orgWidth ;
2016-09-29 03:02:12 -05:00
}
clampSinglePlaneValues ( ) ;
}
2016-09-28 05:39:43 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf : : BoundingBox RimIntersectionBox : : currentCellBoundingBox ( )
{
RimCase * rimCase = NULL ;
2016-09-28 07:35:57 -05:00
this - > firstAncestorOrThisOfType ( rimCase ) ;
2016-09-28 05:39:43 -05:00
CVF_ASSERT ( rimCase ) ;
RimEclipseView * eclView = nullptr ;
2016-09-28 07:35:57 -05:00
this - > firstAncestorOrThisOfType ( eclView ) ;
2016-09-28 05:39:43 -05:00
bool useAllCells = true ;
if ( eclView )
{
useAllCells = eclView - > showInactiveCells ( ) ;
}
if ( false ) //useAllCells) // For now, only use the active CellsBBox.
return rimCase - > allCellsBoundingBox ( ) ;
else
return rimCase - > activeCellsBoundingBox ( ) ;
}