mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merged intersection-box into dev
This commit is contained in:
@@ -700,6 +700,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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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"
|
||||
@@ -32,7 +35,7 @@
|
||||
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimContextCommandBuilder.h"
|
||||
#include "RimCrossSection.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimDefines.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
@@ -54,9 +57,10 @@
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "RivCrossSectionSourceInfo.h"
|
||||
#include "RivFemPartGeometryGenerator.h"
|
||||
#include "RivFemPickSourceInfo.h"
|
||||
#include "RivIntersectionBoxSourceInfo.h"
|
||||
#include "RivIntersectionSourceInfo.h"
|
||||
#include "RivSourceInfo.h"
|
||||
#include "RivTernarySaturationOverlayItem.h"
|
||||
#include "RivWellPathSourceInfo.h"
|
||||
@@ -72,13 +76,12 @@
|
||||
#include "cvfOverlayScalarMapperLegend.h"
|
||||
#include "cvfPart.h"
|
||||
|
||||
#include "WellPathCommands/RicWellPathViewerEventHandler.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QStatusBar>
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// RiaViewerCommands
|
||||
@@ -92,10 +95,11 @@ 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("RicNewPolylineCrossSectionFeature");
|
||||
caf::CmdFeature* cmdFeature = caf::CmdFeatureManager::instance()->getCommandFeature("RicNewPolylineIntersectionFeature");
|
||||
CVF_ASSERT(cmdFeature);
|
||||
|
||||
m_viewerEventHandlers.push_back(dynamic_cast<RicViewerEventInterface*>(cmdFeature));
|
||||
@@ -141,20 +145,36 @@ 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)
|
||||
{
|
||||
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivFemPickSourceInfo* femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivCrossSectionSourceInfo* crossSectionSourceInfo = dynamic_cast<const RivCrossSectionSourceInfo*>(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)
|
||||
{
|
||||
@@ -175,10 +195,15 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
{
|
||||
findCellAndGridIndex(crossSectionSourceInfo, firstPartTriangleIndex, &m_currentCellIndex, &m_currentGridIdx);
|
||||
m_currentFaceIndex = cvf::StructGridInterface::NO_FACE;
|
||||
m_currentCrossSection = const_cast<RimCrossSection*>(crossSectionSourceInfo->crossSection());
|
||||
m_currentCrossSection = const_cast<RimIntersection*>(crossSectionSourceInfo->crossSection());
|
||||
|
||||
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
|
||||
|
||||
@@ -190,6 +215,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());
|
||||
@@ -255,7 +288,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
|
||||
commandIds << "RicNewWellLogFileCurveFeature";
|
||||
commandIds << "RicNewWellLogCurveExtractionFeature";
|
||||
commandIds << "RicNewWellPathCrossSectionFeature";
|
||||
commandIds << "RicNewWellPathIntersectionFeature";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +300,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
{
|
||||
caf::SelectionManager::instance()->setSelectedItem(well);
|
||||
|
||||
commandIds << "RicNewSimWellCrossSectionFeature";
|
||||
commandIds << "RicNewSimWellIntersectionFeature";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,7 +315,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
commandIds << "RicSetMasterViewFeature";
|
||||
}
|
||||
|
||||
commandIds << "RicNewPolylineCrossSectionFeature";
|
||||
commandIds << "RicNewPolylineIntersectionFeature";
|
||||
|
||||
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
|
||||
|
||||
@@ -464,7 +497,8 @@ 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 RivCrossSectionSourceInfo* crossSectionSourceInfo = dynamic_cast<const RivCrossSectionSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivIntersectionSourceInfo* crossSectionSourceInfo = dynamic_cast<const RivIntersectionSourceInfo*>(firstHitPart->sourceInfo());
|
||||
const RivIntersectionBoxSourceInfo* intersectionBoxSourceInfo = dynamic_cast<const RivIntersectionBoxSourceInfo*>(firstHitPart->sourceInfo());
|
||||
|
||||
if (rivSourceInfo)
|
||||
{
|
||||
@@ -486,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())
|
||||
@@ -548,7 +586,15 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewerCommands::findCellAndGridIndex(const RivCrossSectionSourceInfo* crossSectionSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex)
|
||||
cvf::Vec3d RiuViewerCommands::lastPickPositionInDomainCoords() const
|
||||
{
|
||||
return m_currentPickPositionInDomainCoords;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewerCommands::findCellAndGridIndex(const RivIntersectionSourceInfo* crossSectionSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex)
|
||||
{
|
||||
CVF_ASSERT(cellIndex && gridIndex);
|
||||
|
||||
@@ -569,6 +615,30 @@ void RiuViewerCommands::findCellAndGridIndex(const RivCrossSectionSourceInfo* 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 RimCrossSection;
|
||||
class RicViewerEventInterface;
|
||||
class RimEclipseView;
|
||||
class RimGeoMechView;
|
||||
class RimIntersection;
|
||||
class RimView;
|
||||
class RiuViewer;
|
||||
class RivCrossSectionSourceInfo;
|
||||
class RicViewerEventInterface;
|
||||
class RivIntersectionBoxSourceInfo;
|
||||
class RivIntersectionSourceInfo;
|
||||
|
||||
class QMouseEvent;
|
||||
|
||||
@@ -52,8 +53,7 @@ public:
|
||||
|
||||
void displayContextMenu(QMouseEvent* event);
|
||||
void handlePickAction(int winPosX, int winPosY, Qt::KeyboardModifiers keyboardModifiers);
|
||||
|
||||
void findCellAndGridIndex(const RivCrossSectionSourceInfo* crossSectionSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex);
|
||||
cvf::Vec3d lastPickPositionInDomainCoords() const;
|
||||
|
||||
private slots:
|
||||
void slotRangeFilterI();
|
||||
@@ -65,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);
|
||||
@@ -74,9 +77,10 @@ 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<RimCrossSection> m_currentCrossSection;
|
||||
caf::PdmPointer<RimIntersection> m_currentCrossSection;
|
||||
|
||||
QPointer<RiuViewer> m_viewer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user