mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1038 - pre-proto - Added command feature for creating new well log collection fracture from context menu in project tree
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimOilField.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimFracture.h"
|
||||
#include "RimFractureCollection.h"
|
||||
#include "RimProject.h"
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include "QAction.h"
|
||||
#include "RimEclipseWell.h"
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicNewSimWellFractureFeature, "RicNewSimWellFractureFeature");
|
||||
@@ -39,54 +40,26 @@ CAF_CMD_SOURCE_INIT(RicNewSimWellFractureFeature, "RicNewSimWellFractureFeature"
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
if (!pdmUiItem) return;
|
||||
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
CVF_ASSERT(project);
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
|
||||
if (!objHandle) return;
|
||||
|
||||
RimOilField* oilfield = project->activeOilField();
|
||||
if (oilfield == nullptr) return;
|
||||
RimEclipseWell* eclipseWell = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(eclipseWell);
|
||||
|
||||
RimFractureCollection* fracColl = oilfield->fractureCollection();
|
||||
RimFractureCollection* fractureCollection = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(fractureCollection);
|
||||
CVF_ASSERT(fractureCollection);
|
||||
|
||||
|
||||
if (fracColl)
|
||||
{
|
||||
RimFracture* fracture = new RimFracture();
|
||||
fracColl->fractures.push_back(fracture);
|
||||
RimFracture* fracture = new RimFracture();
|
||||
fractureCollection->fractures.push_back(fracture);
|
||||
|
||||
fracture->name = "New Fracture";
|
||||
fracture->name = "New Simulation Well Fracture";
|
||||
//TODO set all relevant defaults...
|
||||
|
||||
|
||||
fracColl->updateConnectedEditors();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// RimSummaryPlot* plot = selectedSummaryPlot();
|
||||
// if (plot)
|
||||
// {
|
||||
// RimSummaryCurve* newCurve = new RimSummaryCurve();
|
||||
// plot->addCurve(newCurve);
|
||||
//
|
||||
// cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable();
|
||||
// newCurve->setColor(curveColor);
|
||||
//
|
||||
// RimSummaryCase* defaultCase = nullptr;
|
||||
// if (project->activeOilField()->summaryCaseCollection()->summaryCaseCount() > 0)
|
||||
// {
|
||||
// defaultCase = project->activeOilField()->summaryCaseCollection()->summaryCase(0);
|
||||
// newCurve->setSummaryCase(defaultCase);
|
||||
// newCurve->setVariable("FOPT");
|
||||
// newCurve->loadDataAndUpdate();
|
||||
// }
|
||||
//
|
||||
// plot->updateConnectedEditors();
|
||||
//
|
||||
// RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(newCurve);
|
||||
// }
|
||||
fractureCollection->updateConnectedEditors();
|
||||
|
||||
}
|
||||
|
||||
@@ -95,7 +68,7 @@ void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSimWellFractureFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
// actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
|
||||
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
|
||||
actionToSetup->setText("New Fracture");
|
||||
}
|
||||
|
||||
@@ -104,5 +77,19 @@ void RicNewSimWellFractureFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewSimWellFractureFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
if (!pdmUiItem) return false;
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
|
||||
if (!objHandle) return false;
|
||||
|
||||
RimEclipseWell* eclipseWell = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType(eclipseWell);
|
||||
|
||||
if (eclipseWell)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user