mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#404) Selecting well path in the tree view when picked in the 3D view
Added method for setting selection based on the picked part.
This commit is contained in:
parent
be29a06883
commit
75dc7376ad
@ -19,8 +19,6 @@
|
||||
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RicEclipsePropertyFilterNewExec.h"
|
||||
#include "RicGeoMechPropertyFilterNewExec.h"
|
||||
#include "RicRangeFilterNewExec.h"
|
||||
@ -66,7 +64,7 @@
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafCmdFeature.h"
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafPdmUiTreeView.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfHitItemCollection.h"
|
||||
@ -131,6 +129,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
if (m_viewer->rayPick(winPosX, winPosY, &hitItems))
|
||||
{
|
||||
extractIntersectionData(hitItems, &localIntersectionPoint, &firstHitPart, &faceIndex, &nncFirstHitPart, NULL);
|
||||
updateSelectionFromPickedPart(firstHitPart);
|
||||
}
|
||||
|
||||
if (firstHitPart && faceIndex != cvf::UNDEFINED_UINT)
|
||||
@ -204,21 +203,6 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
}
|
||||
}
|
||||
|
||||
if (firstHitPart && firstHitPart->sourceInfo())
|
||||
{
|
||||
const RivWellPathSourceInfo* wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(firstHitPart->sourceInfo());
|
||||
if (wellPathSourceInfo)
|
||||
{
|
||||
RimWellPath* wellPath = wellPathSourceInfo->wellPath();
|
||||
if (wellPath)
|
||||
{
|
||||
// TODO: Handle selection through mouse events outside this method, or after ray picking above
|
||||
caf::SelectionManager::instance()->setSelectedItem(wellPath);
|
||||
RiaApplication::instance()->project()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Well log curve creation commands
|
||||
{
|
||||
RicNewWellLogFileCurveFeature* newWellLogFileCurveFeature = dynamic_cast<RicNewWellLogFileCurveFeature*>(caf::CmdFeatureManager::instance()->getCommandFeature("RicNewWellLogFileCurveFeature"));
|
||||
@ -406,6 +390,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
|
||||
if (m_viewer->rayPick(winPosX, winPosY, &hitItems))
|
||||
{
|
||||
extractIntersectionData(hitItems, &localIntersectionPoint, &firstHitPart, &firstPartTriangleIndex, &firstNncHitPart, &nncPartTriangleIndex);
|
||||
updateSelectionFromPickedPart(firstHitPart);
|
||||
}
|
||||
|
||||
if (firstHitPart && firstHitPart->sourceInfo())
|
||||
@ -432,7 +417,6 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
|
||||
}
|
||||
else if (wellPathSourceInfo)
|
||||
{
|
||||
//wellPathIndex = wellPathSourceInfo->wellPathIndex();
|
||||
wellPath = wellPathSourceInfo->wellPath();
|
||||
}
|
||||
}
|
||||
@ -636,3 +620,22 @@ void RiuViewerCommands::ijkFromCellIndex(size_t gridIdx, size_t cellIndex, size
|
||||
geomView->geoMechCase()->geoMechData()->femParts()->part(gridIdx)->structGrid()->ijkFromCellIndex(cellIndex, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewerCommands::updateSelectionFromPickedPart(cvf::Part* part)
|
||||
{
|
||||
if (part && part->sourceInfo())
|
||||
{
|
||||
const RivWellPathSourceInfo* wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(part->sourceInfo());
|
||||
if (wellPathSourceInfo)
|
||||
{
|
||||
RimWellPath* wellPath = wellPathSourceInfo->wellPath();
|
||||
if (wellPath)
|
||||
{
|
||||
RiuMainWindow::instance()->projectTreeView()->selectAsCurrentItem(wellPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ private:
|
||||
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);
|
||||
void updateSelectionFromPickedPart(cvf::Part* part);
|
||||
|
||||
size_t m_currentGridIdx;
|
||||
size_t m_currentCellIndex;
|
||||
|
Loading…
Reference in New Issue
Block a user