(#641) Create user defined polyline by clicking on reservoir cells

This commit is contained in:
Magne Sjaastad
2015-11-27 17:18:30 +01:00
parent 7cd4394102
commit bd2a65acb4
11 changed files with 462 additions and 19 deletions

View File

@@ -649,3 +649,20 @@ cvf::Color3f RiuViewer::computeContrastColor() const
return contrastColor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewer::setActiveUiCommandFeature(RicCommandFeature* uiCommandFeature)
{
CVF_ASSERT(m_viewerCommands);
m_viewerCommands->setActiveUiCommandFeature(uiCommandFeature);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicCommandFeature* RiuViewer::activeUiCommandFeature() const
{
return m_viewerCommands->activeUiCommandFeature();
}

View File

@@ -28,6 +28,7 @@
#include "cafMouseState.h"
#include "cvfStructGrid.h"
class RicCommandFeature;
class RimView;
class RiuSimpleHistogramWidget;
class RiuViewerCommands;
@@ -88,6 +89,9 @@ public:
void setAxisLabels(const cvf::String& xLabel, const cvf::String& yLabel, const cvf::String& zLabel);
void setActiveUiCommandFeature(RicCommandFeature* uiCommandFeature);
RicCommandFeature* activeUiCommandFeature() const;
public slots:
virtual void slotSetCurrentFrame(int frameIndex);
virtual void slotEndAnimation();

View File

@@ -23,6 +23,7 @@
#include "RicGeoMechPropertyFilterNewExec.h"
#include "RicRangeFilterNewExec.h"
#include "CrossSectionCommands/RicNewPolylineCrossSectionFeature.h"
#include "CrossSectionCommands/RicNewSimWellCrossSectionFeature.h"
#include "CrossSectionCommands/RicNewWellPathCrossSectionFeature.h"
#include "WellLogCommands/RicNewWellLogCurveExtractionFeature.h"
@@ -277,6 +278,8 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
commandIds << "RicSetMasterViewFeature";
}
commandIds << "RicNewPolylineCrossSectionFeature";
RimContextCommandBuilder::appendCommandsToMenu(commandIds, &menu);
if (menu.actions().size() > 0)
@@ -439,6 +442,17 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
if (m_viewer->rayPick(winPosX, winPosY, &hitItems))
{
extractIntersectionData(hitItems, &localIntersectionPoint, &firstHitPart, &firstPartTriangleIndex, &firstNncHitPart, &nncPartTriangleIndex);
if (!m_activeUiCommandFeature.isNull())
{
cvf::ref<RicPolylineUiEvent> uiEventObj = new RicPolylineUiEvent(localIntersectionPoint);
if (m_activeUiCommandFeature->handleUiEvent(uiEventObj.p()))
{
return;
}
}
updateSelectionFromPickedPart(firstHitPart);
}
@@ -564,6 +578,22 @@ void RiuViewerCommands::findCellAndGridIndex(const RivCrossSectionSourceInfo* cr
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuViewerCommands::setActiveUiCommandFeature(RicCommandFeature* uiCommandFeature)
{
m_activeUiCommandFeature = uiCommandFeature;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicCommandFeature* RiuViewerCommands::activeUiCommandFeature() const
{
return m_activeUiCommandFeature;
}
//--------------------------------------------------------------------------------------------------
/// Perform picking and return the index of the face that was hit, if a drawable geo was hit
//--------------------------------------------------------------------------------------------------

View File

@@ -31,6 +31,7 @@ class RimGeoMechView;
class RimView;
class RiuViewer;
class RivCrossSectionSourceInfo;
class RicCommandFeature;
class QMouseEvent;
@@ -54,6 +55,9 @@ public:
void findCellAndGridIndex(const RivCrossSectionSourceInfo* crossSectionSourceInfo, cvf::uint firstPartTriangleIndex, size_t* cellIndex, size_t* gridIndex);
void setActiveUiCommandFeature(RicCommandFeature* uiCommandFeature);
RicCommandFeature* activeUiCommandFeature() const;
private slots:
void slotRangeFilterI();
@@ -78,6 +82,8 @@ private:
caf::PdmPointer<RimCrossSection> m_currentCrossSection;
QPointer<RiuViewer> m_viewer;
QPointer<RicCommandFeature> m_activeUiCommandFeature;
};