#1039 - pre-proto - Added command feature for generating new fracture

This commit is contained in:
astridkbjorke 2016-12-19 10:30:14 +01:00
parent 6e25fe2569
commit cd3b6da47f
7 changed files with 177 additions and 6 deletions

View File

@ -37,6 +37,8 @@ ${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.h
${CEE_CURRENT_LIST_DIR}RicExportMultipleSnapshotsFeature.h
${CEE_CURRENT_LIST_DIR}RicNewSimWellFractureFeature.h
# General delete of any object in a child array field
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h
@ -76,6 +78,9 @@ ${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportFaultsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportMultipleSnapshotsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewSimWellFractureFeature.cpp
# General delete of any object in a child array field
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.cpp

View File

@ -0,0 +1,118 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewSimWellFractureFeature.h"
#include "RiaApplication.h"
//
// #include "RimMainPlotCollection.h"
// #include "RimOilField.h"
#include "RimProject.h"
#include "RimFractureCollection.h"
// #include "RimSummaryCaseCollection.h"
// #include "RimSummaryCurve.h"
// #include "RimSummaryPlot.h"
// #include "RimSummaryPlotCollection.h"
//
// #include "RiuMainPlotWindow.h"
//
// #include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
//
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
#include "RimOilField.h"
#include "RimFracture.h"
CAF_CMD_SOURCE_INIT(RicNewSimWellFractureFeature, "RicNewSimWellFractureFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked)
{
RimProject* project = RiaApplication::instance()->project();
CVF_ASSERT(project);
RimOilField* oilfield = project->activeOilField();
if (oilfield == nullptr) return;
RimFractureCollection* fracColl = oilfield->fractureCollection();
if (fracColl)
{
RimFracture* fracture = new RimFracture();
fracColl->fractures.push_back(fracture);
fracture->name = "New Fracture";
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);
// }
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewSimWellFractureFeature::setupActionLook(QAction* actionToSetup)
{
// actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
actionToSetup->setText("New Fracture");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewSimWellFractureFeature::isCommandEnabled()
{
return true;
}

View File

@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <vector>
// class RimSummaryPlot;
//==================================================================================================
///
//==================================================================================================
class RicNewSimWellFractureFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
virtual void onActionTriggered(bool isChecked) override;
virtual void setupActionLook(QAction* actionToSetup) override;
virtual bool isCommandEnabled() override;
private:
// RimSummaryPlot* selectedSummaryPlot() const;
};

View File

@ -59,6 +59,8 @@
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimFractureCollection.h"
#include "ToggleCommands/RicToggleItemsFeatureImpl.h"
#include "cafPdmUiItem.h"
@ -351,6 +353,11 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
{
commandIds << "RicExportFaultsFeature";
}
else if (dynamic_cast<RimFractureCollection*>(uiItem))
{
commandIds << "RicNewSimWellFractureFeature";
}
if (dynamic_cast<RimView*>(uiItem))

View File

@ -53,8 +53,8 @@ RimFracture::RimFracture(void)
CAF_PDM_InitFieldNoDefault(&wellpath, "WellPath", "Well path for measured deph", "", "", "");
CAF_PDM_InitField(&i, "I", 1, "Fracture location cell I", "", "", "");
CAF_PDM_InitField(&i, "J", 1, "Fracture location cell J", "", "", "");
CAF_PDM_InitField(&i, "K", 1, "Fracture location cell K", "", "", "");
CAF_PDM_InitField(&j, "J", 1, "Fracture location cell J", "", "", "");
CAF_PDM_InitField(&k, "K", 1, "Fracture location cell K", "", "", "");
CAF_PDM_InitFieldNoDefault(&fractureDefinition, "FractureDef", "FractureDef", "", "", "");

View File

@ -36,7 +36,7 @@ RimFractureCollection::RimFractureCollection(void)
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
CAF_PDM_InitFieldNoDefault(&fractures, "Fractures", "", "", "", "");
fractures.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------

View File

@ -76,9 +76,6 @@ public:
caf::PdmChildArrayField<RimMultiSnapshotDefinition*> multiSnapshotDefinitions;
caf::PdmChildArrayField<RimFractureDefinition*> fractureDefinition;
caf::PdmChildArrayField<RimFractureCollection*> fractureCollection;
caf::PdmField<QString> mainWindowTreeViewState;
caf::PdmField<QString> mainWindowCurrentModelIndexPath;