mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1038 - pre-proto - added calculation of measured depth along well path when creating new well path fracture in 3D view
This commit is contained in:
parent
d6b3fad85e
commit
46e4815f9a
@ -36,6 +36,8 @@
|
||||
#include "cvfVector3.h"
|
||||
#include "cvfRenderState_FF.h"
|
||||
#include "RiuViewer.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewWellPathCollFractureAtPosFeature, "RicNewWellPathCollFractureAtPosFeature");
|
||||
@ -48,18 +50,24 @@ void RicNewWellPathCollFractureAtPosFeature::onActionTriggered(bool isChecked)
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (!activeView) return;
|
||||
|
||||
std::vector<RimWellPath*> collection;
|
||||
caf::SelectionManager::instance()->objectsByType(&collection);
|
||||
if (collection.size() != 1) return;
|
||||
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
|
||||
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
||||
|
||||
RimWellPath* wellPath = collection[0];
|
||||
RiuWellPathSelectionItem* wellPathItem = nullptr;
|
||||
if (selItem->type() == RiuSelectionItem::WELLPATH_SELECTION_OBJECT)
|
||||
{
|
||||
wellPathItem = static_cast<RiuWellPathSelectionItem*>(selItem);
|
||||
if (!wellPathItem) return;
|
||||
}
|
||||
|
||||
const RivWellPathSourceInfo* wellpathSourceInfo = wellPathItem->m_wellpathSourceInfo;
|
||||
RimWellPath* wellPath = wellpathSourceInfo->wellPath();
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(wellPath);
|
||||
if (!objHandle) return;
|
||||
|
||||
RimWellPathCollection* wellPathColl = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(wellPathColl);
|
||||
CVF_ASSERT(wellPathColl);
|
||||
if (!wellPathColl) return;
|
||||
|
||||
RimFractureCollection* fractureCollection = wellPathColl->fractureCollection();
|
||||
|
||||
@ -69,14 +77,10 @@ void RicNewWellPathCollFractureAtPosFeature::onActionTriggered(bool isChecked)
|
||||
fracture->name = "New Well Path Fracture";
|
||||
fracture->welltype = RimFracture::FRACTURE_WELL_PATH;
|
||||
fracture->wellpath = wellPath;
|
||||
//TODO set all relevant defaults...
|
||||
|
||||
|
||||
cvf::Vec3d domainCoord = activeView->viewer()->lastPickPositionInDomainCoords();
|
||||
fracture->positionAtWellpath = domainCoord;
|
||||
|
||||
|
||||
fracture->positionAtWellpath = wellPathItem->m_currentPickPositionInDomainCoords;
|
||||
|
||||
double measuredDepth = wellpathSourceInfo->measuredDepth(wellPathItem->m_firstPartTriangleIndex, wellPathItem->m_currentPickPositionInDomainCoords);
|
||||
fracture->measuredDepth = measuredDepth;
|
||||
fractureCollection->updateConnectedEditors();
|
||||
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ RimFracture::RimFracture(void)
|
||||
CAF_PDM_InitField(&name, "UserDescription", QString("Fracture Name"), "Name", "", "", "");
|
||||
CAF_PDM_InitField(&welltype,"Type", caf::AppEnum<FractureWellEnum>(FRACTURE_SIMULATION_WELL), "Type", "", "", "");
|
||||
|
||||
CAF_PDM_InitField( &measuredDepth, "MeasuredDepth", 650.0f, "Measured Depth Location (if along well path)", "", "", "");
|
||||
CAF_PDM_InitField( &measuredDepth, "MeasuredDepth", 0.0f, "Measured Depth Location (if along well path)", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&wellpath, "WellPath", "Well path for measured deph", "", "", "");
|
||||
CAF_PDM_InitField( &positionAtWellpath, "PositionAtWellpath", cvf::Vec3d::ZERO, "Fracture Position at Well Path", "", "", "");
|
||||
|
||||
|
@ -21,9 +21,11 @@
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include "RiuSelectionChangedHandler.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -63,6 +65,25 @@ void RiuSelectionManager::selectedItems(std::vector<RiuSelectionItem*>& items, i
|
||||
items = s;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuSelectionItem* RiuSelectionManager::selectedItem(int role /*= RUI_APPLICATION_GLOBAL*/) const
|
||||
{
|
||||
const std::vector<RiuSelectionItem*>& s = m_selection[role];
|
||||
|
||||
if (s.size() == 1)
|
||||
{
|
||||
if (s[0])
|
||||
{
|
||||
return s[0];
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -181,3 +202,16 @@ RiuGeoMechSelectionItem::RiuGeoMechSelectionItem(RimGeoMechView* view,
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWellPathSelectionItem::RiuWellPathSelectionItem(const RivWellPathSourceInfo* wellPathSourceInfo,
|
||||
const cvf::Vec3d& currentPickPositionInDomainCoords,
|
||||
cvf::uint firstPartTriangleIndex)
|
||||
: m_currentPickPositionInDomainCoords(currentPickPositionInDomainCoords),
|
||||
m_wellpathSourceInfo(wellPathSourceInfo),
|
||||
m_firstPartTriangleIndex(firstPartTriangleIndex)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -28,11 +28,14 @@
|
||||
#include <vector>
|
||||
#include <assert.h>
|
||||
#include <array>
|
||||
#include "RivWellPathSourceInfo.h"
|
||||
|
||||
class RimEclipseView;
|
||||
class RiuSelectionChangedHandler;
|
||||
class RiuSelectionItem;
|
||||
class RimGeoMechView;
|
||||
class RimWellPath;
|
||||
class RivWellPathSourceInfo;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@ -57,7 +60,13 @@ public:
|
||||
// Returns selected items
|
||||
// Selection manager owns the selection items
|
||||
void selectedItems(std::vector<RiuSelectionItem*>& items, int role = RUI_APPLICATION_GLOBAL) const;
|
||||
|
||||
|
||||
// Returns selected items
|
||||
// Selection manager owns the selection items
|
||||
RiuSelectionItem* selectedItem(int role = RUI_APPLICATION_GLOBAL) const;
|
||||
// PdmUiItem* selectedItem(int role = SelectionManager::APPLICATION_GLOBAL);
|
||||
|
||||
|
||||
// Append item to selected items
|
||||
// SelectionManager takes ownership of the item
|
||||
void appendItemToSelection(RiuSelectionItem* item, int role = RUI_APPLICATION_GLOBAL);
|
||||
@ -92,7 +101,8 @@ public:
|
||||
enum RiuSelectionType
|
||||
{
|
||||
ECLIPSE_SELECTION_OBJECT,
|
||||
GEOMECH_SELECTION_OBJECT
|
||||
GEOMECH_SELECTION_OBJECT,
|
||||
WELLPATH_SELECTION_OBJECT
|
||||
};
|
||||
|
||||
public:
|
||||
@ -172,3 +182,28 @@ public:
|
||||
cvf::Vec3d m_localIntersectionPoint;
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiuWellPathSelectionItem : public RiuSelectionItem
|
||||
{
|
||||
public:
|
||||
explicit RiuWellPathSelectionItem(const RivWellPathSourceInfo* wellPathSourceInfo,
|
||||
const cvf::Vec3d& currentPickPositionInDomainCoords,
|
||||
cvf::uint firstPartTriangleIndex);
|
||||
|
||||
virtual ~RiuWellPathSelectionItem() {};
|
||||
|
||||
virtual RiuSelectionType type() const
|
||||
{
|
||||
return WELLPATH_SELECTION_OBJECT;
|
||||
}
|
||||
|
||||
public:
|
||||
const RivWellPathSourceInfo* m_wellpathSourceInfo;
|
||||
cvf::Vec3d m_currentPickPositionInDomainCoords;
|
||||
cvf::uint m_firstPartTriangleIndex;
|
||||
};
|
||||
|
@ -293,12 +293,17 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
RimWellPath* wellPath = wellPathSourceInfo->wellPath();
|
||||
if (wellPath)
|
||||
{
|
||||
caf::SelectionManager::instance()->setSelectedItem(wellPath);
|
||||
|
||||
RiuSelectionItem* selItem = new RiuWellPathSelectionItem(wellPathSourceInfo, m_currentPickPositionInDomainCoords, firstPartTriangleIndex);
|
||||
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
|
||||
commandIds << "RicNewWellPathCollFractureAtPosFeature";
|
||||
|
||||
|
||||
//TODO: Update so these also use RiuWellPathSelectionItem
|
||||
caf::SelectionManager::instance()->setSelectedItem(wellPath);
|
||||
commandIds << "RicNewWellLogFileCurveFeature";
|
||||
commandIds << "RicNewWellLogCurveExtractionFeature";
|
||||
commandIds << "RicNewWellPathIntersectionFeature";
|
||||
commandIds << "RicNewWellPathCollFractureAtPosFeature";
|
||||
}
|
||||
}
|
||||
|
||||
@ -603,6 +608,8 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
|
||||
if(intersectionHit) selItem = new RiuGeoMechSelectionItem(geomView, gridIndex, cellIndex, curveColor, gmFace, localIntersectionPoint, intersectionTriangleHit);
|
||||
else selItem = new RiuGeoMechSelectionItem(geomView, gridIndex, cellIndex, curveColor, gmFace, localIntersectionPoint);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (appendToSelection)
|
||||
@ -614,6 +621,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
|
||||
RiuSelectionManager::instance()->setSelectedItem(selItem);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user