#818 Intersection Box: Added XYZ slices to context menu in 3D view

This commit is contained in:
Magne Sjaastad
2016-09-23 16:12:19 +02:00
parent bb81009b33
commit 5c4b92f9b8
13 changed files with 534 additions and 15 deletions

View File

@@ -689,6 +689,16 @@ void RiuViewer::setAxisLabels(const cvf::String& xLabel, const cvf::String& yLab
m_axisCross->setAxisLabels(xLabel, yLabel, zLabel);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RiuViewer::lastPickPositionInDomainCoords() const
{
CVF_ASSERT(m_viewerCommands);
return m_viewerCommands->lastPickPositionInDomainCoords();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -89,6 +89,8 @@ public:
void setAxisLabels(const cvf::String& xLabel, const cvf::String& yLabel, const cvf::String& zLabel);
cvf::Vec3d lastPickPositionInDomainCoords() const;
public slots:
virtual void slotSetCurrentFrame(int frameIndex);
virtual void slotEndAnimation();

View File

@@ -77,6 +77,7 @@
#include <QMenu>
#include <QMouseEvent>
#include <QStatusBar>
#include "RiaApplication.h"
//==================================================================================================
@@ -92,7 +93,8 @@ RiuViewerCommands::RiuViewerCommands(RiuViewer* ownerViewer)
: QObject(ownerViewer),
m_viewer(ownerViewer),
m_currentGridIdx(-1),
m_currentCellIndex(-1)
m_currentCellIndex(-1),
m_currentPickPositionInDomainCoords(cvf::Vec3d::UNDEFINED)
{
{
caf::CmdFeature* cmdFeature = caf::CmdFeatureManager::instance()->getCommandFeature("RicNewPolylineIntersectionFeature");
@@ -141,11 +143,26 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
cvf::Part* firstHitPart = NULL;
cvf::Part* nncFirstHitPart = NULL;
cvf::HitItemCollection hitItems;
m_currentPickPositionInDomainCoords = cvf::Vec3d::UNDEFINED;
cvf::HitItemCollection hitItems;
if (m_viewer->rayPick(winPosX, winPosY, &hitItems))
{
extractIntersectionData(hitItems, &localIntersectionPoint, &firstHitPart, &firstPartTriangleIndex, &nncFirstHitPart, NULL);
cvf::Vec3d displayModelOffset = cvf::Vec3d::ZERO;
RimView* activeView = RiaApplication::instance()->activeReservoirView();
CVF_ASSERT(activeView);
RimCase* rimCase = NULL;
activeView->firstAnchestorOrThisOfType(rimCase);
if (rimCase)
{
displayModelOffset = rimCase->displayModelOffset();
}
m_currentPickPositionInDomainCoords = localIntersectionPoint + displayModelOffset;
}
if (firstHitPart && firstPartTriangleIndex != cvf::UNDEFINED_UINT)
@@ -190,6 +207,14 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
menu.addAction(QIcon(":/CellFilter_Range.png"), QString("I-slice range filter"), this, SLOT(slotRangeFilterI()));
menu.addAction(QIcon(":/CellFilter_Range.png"), QString("J-slice range filter"), this, SLOT(slotRangeFilterJ()));
menu.addAction(QIcon(":/CellFilter_Range.png"), QString("K-slice range filter"), this, SLOT(slotRangeFilterK()));
menu.addSeparator();
menu.addAction(caf::CmdFeatureManager::instance()->action("RicIntersectionBoxXSliceFeature"));
menu.addAction(caf::CmdFeatureManager::instance()->action("RicIntersectionBoxYSliceFeature"));
menu.addAction(caf::CmdFeatureManager::instance()->action("RicIntersectionBoxZSliceFeature"));
menu.addSeparator();
}
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
@@ -545,6 +570,14 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RiuViewerCommands::lastPickPositionInDomainCoords() const
{
return m_currentPickPositionInDomainCoords;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -52,6 +52,7 @@ public:
void displayContextMenu(QMouseEvent* event);
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);
@@ -74,6 +75,7 @@ private:
size_t m_currentGridIdx;
size_t m_currentCellIndex;
cvf::StructGridInterface::FaceType m_currentFaceIndex;
cvf::Vec3d m_currentPickPositionInDomainCoords;
caf::PdmPointer<RimView> m_reservoirView;
caf::PdmPointer<RimIntersection> m_currentCrossSection;