diff --git a/ApplicationCode/UserInterface/RiuCellAndNncPickEventHandler.cpp b/ApplicationCode/UserInterface/RiuCellAndNncPickEventHandler.cpp index 0afdf0ac28..3db68b95ee 100644 --- a/ApplicationCode/UserInterface/RiuCellAndNncPickEventHandler.cpp +++ b/ApplicationCode/UserInterface/RiuCellAndNncPickEventHandler.cpp @@ -153,24 +153,24 @@ bool RiuCellAndNncPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& eve else if ( const RivReservoirSurfaceIntersectionSourceInfo* surfeIntersectSourceInfo = dynamic_cast( firstHitPart->sourceInfo() ) ) { - RiuViewerCommands::findCellAndGridIndex( mainOrComparisonView, - surfeIntersectSourceInfo, - firstPartTriangleIndex, - &gridLocalCellIndex, - &gridIndex ); + RiuViewerCommands::findCellAndGridIndex( mainOrComparisonView, + surfeIntersectSourceInfo->intersection()->activeSeparateResultDefinition(), + surfeIntersectSourceInfo->triangleToCellIndex()[firstPartTriangleIndex], + &gridLocalCellIndex, + &gridIndex ); - intersectionHit = true; + intersectionHit = true; intersectionTriangleHit = surfeIntersectSourceInfo->triangle( firstPartTriangleIndex ); sepInterResDef = surfeIntersectSourceInfo->intersection()->activeSeparateResultDefinition(); } else if ( const RivExtrudedCurveIntersectionSourceInfo* intersectionSourceInfo = dynamic_cast( firstHitPart->sourceInfo() ) ) { - RiuViewerCommands::findCellAndGridIndex( mainOrComparisonView, - intersectionSourceInfo, - firstPartTriangleIndex, - &gridLocalCellIndex, - &gridIndex ); + RiuViewerCommands::findCellAndGridIndex( mainOrComparisonView, + intersectionSourceInfo->intersection()->activeSeparateResultDefinition(), + intersectionSourceInfo->triangleToCellIndex()[firstPartTriangleIndex], + &gridLocalCellIndex, + &gridIndex ); intersectionHit = true; intersectionTriangleHit = intersectionSourceInfo->triangle( firstPartTriangleIndex ); @@ -179,11 +179,11 @@ bool RiuCellAndNncPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& eve else if ( const RivBoxIntersectionSourceInfo* intersectionBoxSourceInfo = dynamic_cast( firstHitPart->sourceInfo() ) ) { - RiuViewerCommands::findCellAndGridIndex( mainOrComparisonView, - intersectionBoxSourceInfo, - firstPartTriangleIndex, - &gridLocalCellIndex, - &gridIndex ); + RiuViewerCommands::findCellAndGridIndex( mainOrComparisonView, + intersectionBoxSourceInfo->intersectionBox()->activeSeparateResultDefinition(), + intersectionBoxSourceInfo->triangleToCellIndex()[firstPartTriangleIndex], + &gridLocalCellIndex, + &gridIndex ); intersectionHit = true; intersectionTriangleHit = intersectionBoxSourceInfo->triangle( firstPartTriangleIndex ); diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.cpp b/ApplicationCode/UserInterface/RiuViewerCommands.cpp index 445797b994..d3b0c17e4f 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationCode/UserInterface/RiuViewerCommands.cpp @@ -306,17 +306,11 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event ) else if ( surfIntersectSourceInfo ) { findCellAndGridIndex( mainOrComparisonView, - surfIntersectSourceInfo, - firstPartTriangleIndex, + surfIntersectSourceInfo->intersection()->activeSeparateResultDefinition(), + surfIntersectSourceInfo->triangleToCellIndex()[firstPartTriangleIndex], &m_currentCellIndex, &m_currentGridIdx ); - // findCellAndGridIndex( mainOrComparisonView, - // surfIntersectSourceInfo->intersection()->activeSeparateResultDefinition(), - // surfIntersectSourceInfo->triangleToCellIndex()[firstPartTriangleIndex], - // &m_currentCellIndex, - // &m_currentGridIdx ); - m_currentFaceIndex = cvf::StructGridInterface::NO_FACE; RiuSelectionItem* selItem = new RiuGeneralSelectionItem( surfIntersectSourceInfo->intersection() ); @@ -331,10 +325,11 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event ) else if ( crossSectionSourceInfo ) { findCellAndGridIndex( mainOrComparisonView, - crossSectionSourceInfo, - firstPartTriangleIndex, + crossSectionSourceInfo->intersection()->activeSeparateResultDefinition(), + crossSectionSourceInfo->triangleToCellIndex()[firstPartTriangleIndex], &m_currentCellIndex, &m_currentGridIdx ); + m_currentFaceIndex = cvf::StructGridInterface::NO_FACE; RiuSelectionItem* selItem = new RiuGeneralSelectionItem( crossSectionSourceInfo->intersection() ); @@ -355,10 +350,11 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event ) else if ( intersectionBoxSourceInfo ) { findCellAndGridIndex( mainOrComparisonView, - intersectionBoxSourceInfo, - firstPartTriangleIndex, + intersectionBoxSourceInfo->intersectionBox()->activeSeparateResultDefinition(), + intersectionBoxSourceInfo->triangleToCellIndex()[firstPartTriangleIndex], &m_currentCellIndex, &m_currentGridIdx ); + m_currentFaceIndex = cvf::StructGridInterface::NO_FACE; RiuSelectionItem* selItem = new RiuGeneralSelectionItem( intersectionBoxSourceInfo->intersectionBox() ); @@ -1064,126 +1060,6 @@ void RiuViewerCommands::findCellAndGridIndex( Rim3dView* m } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuViewerCommands::findCellAndGridIndex( Rim3dView* mainOrComparisonView, - const RivReservoirSurfaceIntersectionSourceInfo* crossSectionSourceInfo, - cvf::uint firstPartTriangleIndex, - size_t* cellIndex, - size_t* gridIndex ) -{ - CVF_ASSERT( cellIndex && gridIndex ); - RimEclipseCase* eclipseCase = nullptr; - - if ( RimIntersectionResultDefinition* sepInterResDef = - crossSectionSourceInfo->intersection()->activeSeparateResultDefinition() ) - { - if ( sepInterResDef->isEclipseResultDefinition() ) - { - eclipseCase = dynamic_cast( sepInterResDef->activeCase() ); - } - } - else - { - eclipseCase = dynamic_cast( mainOrComparisonView->ownerCase() ); - } - - size_t globalCellIndex = crossSectionSourceInfo->triangleToCellIndex()[firstPartTriangleIndex]; - - if ( eclipseCase ) - { - const RigCell& cell = eclipseCase->mainGrid()->globalCellArray()[globalCellIndex]; - *cellIndex = cell.gridLocalCellIndex(); - *gridIndex = cell.hostGrid()->gridIndex(); - } - else - { - *cellIndex = crossSectionSourceInfo->triangleToCellIndex()[firstPartTriangleIndex]; - *gridIndex = 0; - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuViewerCommands::findCellAndGridIndex( Rim3dView* mainOrComparisonView, - const RivExtrudedCurveIntersectionSourceInfo* crossSectionSourceInfo, - cvf::uint firstPartTriangleIndex, - size_t* cellIndex, - size_t* gridIndex ) -{ - CVF_ASSERT( cellIndex && gridIndex ); - RimEclipseCase* eclipseCase = nullptr; - - if ( RimIntersectionResultDefinition* sepInterResDef = - crossSectionSourceInfo->intersection()->activeSeparateResultDefinition() ) - { - if ( sepInterResDef->isEclipseResultDefinition() ) - { - eclipseCase = dynamic_cast( sepInterResDef->activeCase() ); - } - } - else - { - eclipseCase = dynamic_cast( mainOrComparisonView->ownerCase() ); - } - - size_t globalCellIndex = crossSectionSourceInfo->triangleToCellIndex()[firstPartTriangleIndex]; - - if ( eclipseCase ) - { - const RigCell& cell = eclipseCase->mainGrid()->globalCellArray()[globalCellIndex]; - *cellIndex = cell.gridLocalCellIndex(); - *gridIndex = cell.hostGrid()->gridIndex(); - } - else - { - *cellIndex = crossSectionSourceInfo->triangleToCellIndex()[firstPartTriangleIndex]; - *gridIndex = 0; - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuViewerCommands::findCellAndGridIndex( Rim3dView* mainOrComparisonView, - const RivBoxIntersectionSourceInfo* intersectionBoxSourceInfo, - cvf::uint firstPartTriangleIndex, - size_t* cellIndex, - size_t* gridIndex ) -{ - CVF_ASSERT( cellIndex && gridIndex ); - RimEclipseCase* eclipseCase = nullptr; - - if ( RimIntersectionResultDefinition* sepInterResDef = - intersectionBoxSourceInfo->intersectionBox()->activeSeparateResultDefinition() ) - { - if ( sepInterResDef->isEclipseResultDefinition() ) - { - eclipseCase = dynamic_cast( sepInterResDef->activeCase() ); - } - } - else - { - eclipseCase = dynamic_cast( mainOrComparisonView->ownerCase() ); - } - - size_t globalCellIndex = intersectionBoxSourceInfo->triangleToCellIndex()[firstPartTriangleIndex]; - - if ( eclipseCase ) - { - const RigCell& cell = eclipseCase->mainGrid()->globalCellArray()[globalCellIndex]; - *cellIndex = cell.gridLocalCellIndex(); - *gridIndex = cell.hostGrid()->gridIndex(); - } - else - { - *cellIndex = intersectionBoxSourceInfo->triangleToCellIndex()[firstPartTriangleIndex]; - *gridIndex = 0; - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuViewerCommands.h b/ApplicationCode/UserInterface/RiuViewerCommands.h index 18c1a63be9..9aaf3b9732 100644 --- a/ApplicationCode/UserInterface/RiuViewerCommands.h +++ b/ApplicationCode/UserInterface/RiuViewerCommands.h @@ -80,21 +80,6 @@ public: size_t globalCellIndex, size_t* cellIndex, size_t* gridIndex ); - static void findCellAndGridIndex( Rim3dView* mainOrComparisonView, - const RivReservoirSurfaceIntersectionSourceInfo* crossSectionSourceInfo, - cvf::uint firstPartTriangleIndex, - size_t* cellIndex, - size_t* gridIndex ); - static void findCellAndGridIndex( Rim3dView* mainOrComparisonView, - const RivExtrudedCurveIntersectionSourceInfo* intersectionSourceInfo, - cvf::uint firstPartTriangleIndex, - size_t* cellIndex, - size_t* gridIndex ); - static void findCellAndGridIndex( Rim3dView* mainOrComparisonView, - const RivBoxIntersectionSourceInfo* intersectionBoxSourceInfo, - cvf::uint firstPartTriangleIndex, - size_t* cellIndex, - size_t* gridIndex ); private: void ijkFromCellIndex( Rim3dView* mainOrComparisonView,