mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1592 Move new well path fracture feature to WellPathFractureCollection
This commit is contained in:
parent
395e232b77
commit
8f003449b2
@ -18,8 +18,11 @@
|
||||
|
||||
#include "RicNewWellPathFractureFeature.h"
|
||||
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
|
||||
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
@ -48,28 +51,27 @@ CAF_CMD_SOURCE_INIT(RicNewWellPathFractureFeature, "RicNewWellPathFractureFeatur
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellPathFractureFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
if (!pdmUiItem) return;
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
|
||||
if (!objHandle) return;
|
||||
RimWellPathFractureCollection* fractureColl = RicNewWellPathFractureFeature::selectedWellPathFractureCollection();
|
||||
if (!fractureColl) return;
|
||||
|
||||
RimWellPath* wellPath = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(wellPath);
|
||||
CVF_ASSERT(wellPath);
|
||||
fractureColl->firstAncestorOrThisOfTypeAsserted(wellPath);
|
||||
|
||||
if (!RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem(wellPath)) return;
|
||||
|
||||
RimWellPathFracture* fracture = new RimWellPathFracture();
|
||||
wellPath->fractureCollection()->fractures.push_back(fracture);
|
||||
fractureColl->fractures.push_back(fracture);
|
||||
|
||||
float md_default = 0.0f;
|
||||
fracture->setMeasuredDepth(md_default);
|
||||
fracture->fractureUnit = wellPath->unitSystem();
|
||||
|
||||
RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
|
||||
cvf::Vec3d positionAtWellpath = wellPathGeometry->interpolatedPointAlongWellPath(md_default);
|
||||
fracture->setAnchorPosition(positionAtWellpath);
|
||||
|
||||
RimOilField* oilfield = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(oilfield);
|
||||
fractureColl->firstAncestorOrThisOfType(oilfield);
|
||||
if (!oilfield) return;
|
||||
|
||||
std::vector<RimFracture* > oldFractures;
|
||||
@ -88,7 +90,7 @@ void RicNewWellPathFractureFeature::onActionTriggered(bool isChecked)
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(fracture);
|
||||
|
||||
RimWellPathCollection* wellPathColl = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(wellPathColl);
|
||||
fractureColl->firstAncestorOrThisOfType(wellPathColl);
|
||||
if (wellPathColl)
|
||||
{
|
||||
wellPathColl->scheduleGeometryRegenAndRedrawViews();
|
||||
@ -109,19 +111,28 @@ void RicNewWellPathFractureFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewWellPathFractureFeature::isCommandEnabled()
|
||||
{
|
||||
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
if (!pdmUiItem) return false;
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
|
||||
if (!objHandle) return false;
|
||||
|
||||
RimWellPathCollection* wellPathColl = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(wellPathColl);
|
||||
|
||||
if (wellPathColl)
|
||||
if (selectedWellPathFractureCollection())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPathFractureCollection* RicNewWellPathFractureFeature::selectedWellPathFractureCollection()
|
||||
{
|
||||
RimWellPathFractureCollection* objToFind = nullptr;
|
||||
|
||||
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
|
||||
if (objHandle)
|
||||
{
|
||||
objHandle->firstAncestorOrThisOfType(objToFind);
|
||||
}
|
||||
|
||||
return objToFind;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimWellPathFractureCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -29,11 +30,12 @@
|
||||
class RicNewWellPathFractureFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
protected:
|
||||
|
||||
protected:
|
||||
virtual void onActionTriggered(bool isChecked) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
virtual bool isCommandEnabled() override;
|
||||
|
||||
|
||||
private:
|
||||
static RimWellPathFractureCollection* selectedWellPathFractureCollection();
|
||||
};
|
||||
|
@ -222,7 +222,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
commandIds << "RicNewWellLogFileCurveFeature";
|
||||
commandIds << "RicNewWellLogCurveExtractionFeature";
|
||||
commandIds << "RicNewWellPathIntersectionFeature";
|
||||
commandIds << "RicNewWellPathFractureFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimCalcScript*>(uiItem))
|
||||
{
|
||||
@ -378,10 +377,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicShowFlowCharacteristicsPlotFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellPathFracture*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewWellPathFractureFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimSimWellFracture*>(uiItem))
|
||||
{
|
||||
commandIds << "RicNewSimWellFractureFeature";
|
||||
@ -443,6 +438,9 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
commandIds << "RicWellPathImportCompletionsFileFeature";
|
||||
commandIds << "RicFlyToObjectFeature";
|
||||
|
||||
// Fracture commands
|
||||
commandIds << "RicNewWellPathFractureFeature";
|
||||
|
||||
// Work in progress -- End
|
||||
|
||||
caf::PdmUiItem* uiItem = uiItems[0];
|
||||
|
Loading…
Reference in New Issue
Block a user