#1044 - pre-proto - Added function for creating new sim well fracture, not yet setting correct i j k

This commit is contained in:
astridkbjorke
2017-01-03 09:34:31 +01:00
parent 4852de419f
commit b3bc0a9135
6 changed files with 99 additions and 5 deletions

View File

@@ -31,6 +31,8 @@
#include "cvfAssert.h"
#include <QAction>
#include "RiuSelectionManager.h"
#include "RivWellPipeSourceInfo.h"
CAF_CMD_SOURCE_INIT(RicNewSimWellFractureAtPosFeature, "RicNewSimWellFractureAtPosFeature");
@@ -40,8 +42,43 @@ CAF_CMD_SOURCE_INIT(RicNewSimWellFractureAtPosFeature, "RicNewSimWellFractureAtP
//--------------------------------------------------------------------------------------------------
void RicNewSimWellFractureAtPosFeature::onActionTriggered(bool isChecked)
{
// Not yet implemented
// Infrastructure is missing for being able to obtain i j and k when right-clicking
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return;
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
RiuSimWellSelectionItem* simWellItem = nullptr;
if (selItem->type() == RiuSelectionItem::SIMWELL_SELECTION_OBJECT)
{
simWellItem = static_cast<RiuSimWellSelectionItem*>(selItem);
if (!simWellItem) return;
}
const RivEclipseWellSourceInfo* simwellSourceInfo = simWellItem->m_simwellSourceInfo;
RimEclipseWell* simWell = simwellSourceInfo->well();
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(simWell);
if (!objHandle) return;
RimEclipseWell* simWellObject = nullptr;
objHandle->firstAncestorOrThisOfType(simWellObject);
if (!simWellObject) return;
RimSimWellFractureCollection* fractureCollection = simWellObject->simwellFractureCollection();
if (!fractureCollection) return;
RimSimWellFracture* fracture = new RimSimWellFracture();
fractureCollection->simwellFractures.push_back(fracture);
fracture->name = "New SimWell Fracture";
fracture->i = static_cast<int>(simWellItem->i);
fracture->j = static_cast<int>(simWellItem->j);
fracture->k = static_cast<int>(simWellItem->k);
fractureCollection->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -28,6 +28,8 @@
#include "RimWellPathFracture.h"
#include "RimWellPathFractureCollection.h"
#include "RivWellPathSourceInfo.h"
#include "RiuSelectionManager.h"
#include "RiuViewer.h"

View File

@@ -44,6 +44,7 @@ public:
caf::PdmField<QString> name;
caf::PdmPtrField<RimFractureDefinition* > fractureDefinition;
size_t gridindex;
caf::PdmField<int> i;
caf::PdmField<int> j;
caf::PdmField<int> k;

View File

@@ -215,3 +215,18 @@ RiuWellPathSelectionItem::RiuWellPathSelectionItem(const RivWellPathSourceInfo*
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuSimWellSelectionItem::RiuSimWellSelectionItem(const RivEclipseWellSourceInfo* simwellSourceInfo,
size_t i,
size_t j,
size_t k)
: m_simwellSourceInfo(simwellSourceInfo),
i(i),
j(j),
k(k)
{
}

View File

@@ -28,7 +28,8 @@
#include <vector>
#include <assert.h>
#include <array>
#include "RivWellPathSourceInfo.h"
// #include "RivWellPathSourceInfo.h"
// #include "RivWellPipeSourceInfo.h"
class RimEclipseView;
class RiuSelectionChangedHandler;
@@ -36,6 +37,7 @@ class RiuSelectionItem;
class RimGeoMechView;
class RimWellPath;
class RivWellPathSourceInfo;
class RivEclipseWellSourceInfo;
//==================================================================================================
//
@@ -102,7 +104,8 @@ public:
{
ECLIPSE_SELECTION_OBJECT,
GEOMECH_SELECTION_OBJECT,
WELLPATH_SELECTION_OBJECT
WELLPATH_SELECTION_OBJECT,
SIMWELL_SELECTION_OBJECT
};
public:
@@ -207,3 +210,32 @@ public:
cvf::Vec3d m_currentPickPositionInDomainCoords;
cvf::uint m_firstPartTriangleIndex;
};
//==================================================================================================
//
//
//
//==================================================================================================
class RiuSimWellSelectionItem : public RiuSelectionItem
{
public:
explicit RiuSimWellSelectionItem(const RivEclipseWellSourceInfo* simwellSourceInfo,
size_t i, size_t j, size_t k);
virtual ~RiuSimWellSelectionItem() {};
virtual RiuSelectionType type() const
{
return SIMWELL_SELECTION_OBJECT;
}
public:
caf::PdmPointer<RimEclipseView> m_view;
const RivEclipseWellSourceInfo* m_simwellSourceInfo;
size_t i;
size_t j;
size_t k;
};

View File

@@ -314,8 +314,15 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
if (well)
{
caf::SelectionManager::instance()->setSelectedItem(well);
commandIds << "RicNewSimWellIntersectionFeature";
size_t i = 0;
size_t j = 0;
size_t k = 0;
RiuSelectionItem* selItem = new RiuSimWellSelectionItem(eclipseWellSourceInfo, i, j, k);
RiuSelectionManager::instance()->setSelectedItem(selItem, RiuSelectionManager::RUI_TEMPORARY);
commandIds << "RicNewSimWellFractureAtPosFeature";
}
}