mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#888 Intersection Box: Enable picking on intersection box geometry
This commit is contained in:
@@ -19,10 +19,13 @@
|
||||
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RicViewerEventInterface.h"
|
||||
#include "RicEclipsePropertyFilterNewExec.h"
|
||||
#include "RicGeoMechPropertyFilterNewExec.h"
|
||||
#include "RicRangeFilterNewExec.h"
|
||||
#include "WellPathCommands/RicWellPathViewerEventHandler.h"
|
||||
|
||||
#include "RigCaseData.h"
|
||||
#include "RigFault.h"
|
||||
@@ -54,9 +57,10 @@
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "RivIntersectionSourceInfo.h"
|
||||
#include "RivFemPartGeometryGenerator.h"
|
||||
#include "RivFemPickSourceInfo.h"
|
||||
#include "RivIntersectionBoxSourceInfo.h"
|
||||
#include "RivIntersectionSourceInfo.h"
|
||||
#include "RivSourceInfo.h"
|
||||
#include "RivTernarySaturationOverlayItem.h"
|
||||
#include "RivWellPathSourceInfo.h"
|
||||
@@ -72,12 +76,10 @@
|
||||
#include "cvfOverlayScalarMapperLegend.h"
|
||||
#include "cvfPart.h"
|
||||
|
||||
#include "WellPathCommands/RicWellPathViewerEventHandler.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QStatusBar>
|
||||
#include "RiaApplication.h"
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
@@ -170,8 +172,9 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivFemPickSourceInfo* femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivIntersectionSourceInfo* crossSectionSourceInfo = dynamic_cast<const RivIntersectionSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo = dynamic_cast<const RivIntersectionBoxSourceInfo*>(firstHitPart->sourceInfo());
|
||||
|
||||
if (rivSourceInfo || femSourceInfo || crossSectionSourceInfo)
|
||||
if (rivSourceInfo || femSourceInfo || crossSectionSourceInfo || intersectionBoxSourceInfo)
|
||||
{
|
||||
if (rivSourceInfo)
|
||||
{
|
||||
@@ -196,6 +199,11 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
|
||||
menu.addAction(QString("Hide intersection"), this, SLOT(slotHideIntersection()));
|
||||
}
|
||||
else if (intersectionBoxSourceInfo)
|
||||
{
|
||||
findCellAndGridIndex(intersectionBoxSourceInfo, firstPartTriangleIndex, &m_currentCellIndex, &m_currentGridIdx);
|
||||
m_currentFaceIndex = cvf::StructGridInterface::NO_FACE;
|
||||
}
|
||||
|
||||
// IJK -slice commands
|
||||
|
||||
@@ -490,6 +498,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
|
||||
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivFemPickSourceInfo* femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivIntersectionSourceInfo* crossSectionSourceInfo = dynamic_cast<const RivIntersectionSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo = dynamic_cast<const RivIntersectionBoxSourceInfo*>(firstHitPart->sourceInfo());
|
||||
|
||||
if (rivSourceInfo)
|
||||
{
|
||||
@@ -511,6 +520,10 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
|
||||
{
|
||||
findCellAndGridIndex(crossSectionSourceInfo, firstPartTriangleIndex, &cellIndex, &gridIndex);
|
||||
}
|
||||
else if (intersectionBoxSourceInfo)
|
||||
{
|
||||
findCellAndGridIndex(intersectionBoxSourceInfo, firstPartTriangleIndex, &cellIndex, &gridIndex);
|
||||
}
|
||||
}
|
||||
|
||||
if (firstNncHitPart && firstNncHitPart->sourceInfo())
|
||||
@@ -602,6 +615,30 @@ void RiuViewerCommands::findCellAndGridIndex(const RivIntersectionSourceInfo* cr
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewerCommands::findCellAndGridIndex(const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex)
|
||||
{
|
||||
CVF_ASSERT(cellIndex && gridIndex);
|
||||
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
|
||||
RimGeoMechView* geomView = dynamic_cast<RimGeoMechView*>(m_reservoirView.p());
|
||||
if (eclipseView)
|
||||
{
|
||||
size_t globalCellIndex = intersectionBoxSourceInfo->triangleToCellIndex()[firstPartTriangleIndex];
|
||||
|
||||
const RigCell& cell = eclipseView->eclipseCase()->reservoirData()->mainGrid()->globalCellArray()[globalCellIndex];
|
||||
*cellIndex = cell.gridLocalCellIndex();
|
||||
*gridIndex = cell.hostGrid()->gridIndex();
|
||||
}
|
||||
else if (geomView)
|
||||
{
|
||||
*cellIndex = intersectionBoxSourceInfo->triangleToCellIndex()[firstPartTriangleIndex];
|
||||
*gridIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Perform picking and return the index of the face that was hit, if a drawable geo was hit
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -25,13 +25,14 @@
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
|
||||
class RimIntersection;
|
||||
class RicViewerEventInterface;
|
||||
class RimEclipseView;
|
||||
class RimGeoMechView;
|
||||
class RimIntersection;
|
||||
class RimView;
|
||||
class RiuViewer;
|
||||
class RivIntersectionBoxSourceInfo;
|
||||
class RivIntersectionSourceInfo;
|
||||
class RicViewerEventInterface;
|
||||
|
||||
class QMouseEvent;
|
||||
|
||||
@@ -54,8 +55,6 @@ public:
|
||||
void handlePickAction(int winPosX, int winPosY, Qt::KeyboardModifiers keyboardModifiers);
|
||||
cvf::Vec3d lastPickPositionInDomainCoords() const;
|
||||
|
||||
void findCellAndGridIndex(const RivIntersectionSourceInfo* crossSectionSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex);
|
||||
|
||||
private slots:
|
||||
void slotRangeFilterI();
|
||||
void slotRangeFilterJ();
|
||||
@@ -66,6 +65,9 @@ private slots:
|
||||
void slotHideIntersection();
|
||||
|
||||
private:
|
||||
void findCellAndGridIndex(const RivIntersectionSourceInfo* crossSectionSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex);
|
||||
void findCellAndGridIndex(const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex);
|
||||
|
||||
void ijkFromCellIndex(size_t gridIdx, size_t cellIndex, size_t* i, size_t* j, size_t* k);
|
||||
void createSliceRangeFilter(int ijOrk);
|
||||
void extractIntersectionData(const cvf::HitItemCollection& hitItems, cvf::Vec3d* localIntersectionPoint, cvf::Part** firstPart, uint* firstPartFaceHit, cvf::Part** nncPart, uint* nncPartFaceHit);
|
||||
|
||||
Reference in New Issue
Block a user