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:
@@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
#include "RiuViewerCommands.h"
|
#include "RiuViewerCommands.h"
|
||||||
|
|
||||||
#include "RiaApplication.h"
|
|
||||||
|
|
||||||
#include "RicEclipsePropertyFilterNewExec.h"
|
#include "RicEclipsePropertyFilterNewExec.h"
|
||||||
#include "RicGeoMechPropertyFilterNewExec.h"
|
#include "RicGeoMechPropertyFilterNewExec.h"
|
||||||
#include "RicRangeFilterNewExec.h"
|
#include "RicRangeFilterNewExec.h"
|
||||||
@@ -66,7 +64,7 @@
|
|||||||
#include "cafCmdExecCommandManager.h"
|
#include "cafCmdExecCommandManager.h"
|
||||||
#include "cafCmdFeature.h"
|
#include "cafCmdFeature.h"
|
||||||
#include "cafCmdFeatureManager.h"
|
#include "cafCmdFeatureManager.h"
|
||||||
#include "cafSelectionManager.h"
|
#include "cafPdmUiTreeView.h"
|
||||||
|
|
||||||
#include "cvfDrawableGeo.h"
|
#include "cvfDrawableGeo.h"
|
||||||
#include "cvfHitItemCollection.h"
|
#include "cvfHitItemCollection.h"
|
||||||
@@ -131,6 +129,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
|||||||
if (m_viewer->rayPick(winPosX, winPosY, &hitItems))
|
if (m_viewer->rayPick(winPosX, winPosY, &hitItems))
|
||||||
{
|
{
|
||||||
extractIntersectionData(hitItems, &localIntersectionPoint, &firstHitPart, &faceIndex, &nncFirstHitPart, NULL);
|
extractIntersectionData(hitItems, &localIntersectionPoint, &firstHitPart, &faceIndex, &nncFirstHitPart, NULL);
|
||||||
|
updateSelectionFromPickedPart(firstHitPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstHitPart && faceIndex != cvf::UNDEFINED_UINT)
|
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
|
// Well log curve creation commands
|
||||||
{
|
{
|
||||||
RicNewWellLogFileCurveFeature* newWellLogFileCurveFeature = dynamic_cast<RicNewWellLogFileCurveFeature*>(caf::CmdFeatureManager::instance()->getCommandFeature("RicNewWellLogFileCurveFeature"));
|
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))
|
if (m_viewer->rayPick(winPosX, winPosY, &hitItems))
|
||||||
{
|
{
|
||||||
extractIntersectionData(hitItems, &localIntersectionPoint, &firstHitPart, &firstPartTriangleIndex, &firstNncHitPart, &nncPartTriangleIndex);
|
extractIntersectionData(hitItems, &localIntersectionPoint, &firstHitPart, &firstPartTriangleIndex, &firstNncHitPart, &nncPartTriangleIndex);
|
||||||
|
updateSelectionFromPickedPart(firstHitPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstHitPart && firstHitPart->sourceInfo())
|
if (firstHitPart && firstHitPart->sourceInfo())
|
||||||
@@ -432,7 +417,6 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY)
|
|||||||
}
|
}
|
||||||
else if (wellPathSourceInfo)
|
else if (wellPathSourceInfo)
|
||||||
{
|
{
|
||||||
//wellPathIndex = wellPathSourceInfo->wellPathIndex();
|
|
||||||
wellPath = wellPathSourceInfo->wellPath();
|
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);
|
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 ijkFromCellIndex(size_t gridIdx, size_t cellIndex, size_t* i, size_t* j, size_t* k);
|
||||||
void createSliceRangeFilter(int ijOrk);
|
void createSliceRangeFilter(int ijOrk);
|
||||||
void extractIntersectionData(const cvf::HitItemCollection& hitItems, cvf::Vec3d* localIntersectionPoint, cvf::Part** firstPart, uint* firstPartFaceHit, cvf::Part** nncPart, uint* nncPartFaceHit);
|
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_currentGridIdx;
|
||||||
size_t m_currentCellIndex;
|
size_t m_currentCellIndex;
|
||||||
|
|||||||
Reference in New Issue
Block a user