Added a "Close" command on Geomech cases

See issue #292
This commit is contained in:
Jacob Støren
2015-05-20 13:45:46 +02:00
parent 10388ea3dc
commit 249823c970
4 changed files with 47 additions and 0 deletions

View File

@@ -173,6 +173,37 @@ void RimUiTreeModelPdm::deleteReservoirViews(const std::vector<caf::PdmUiItem*>&
clearClipboard();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimUiTreeModelPdm::deleteGeoMechCases(const std::vector<caf::PdmUiItem*>& treeSelection)
{
std::set<caf::PdmObject*> allParents;
for (size_t sIdx = 0; sIdx < treeSelection.size(); ++sIdx)
{
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(treeSelection[sIdx]);
if (!geomCase) continue;
std::vector<caf::PdmObject*> parents;
geomCase->parentObjects(parents);
for (size_t pIdx = 0; pIdx < treeSelection.size(); ++pIdx)
{
allParents.insert(parents[pIdx]);
}
geomCase->removeFromParentFields();
delete geomCase;
}
for (std::set<caf::PdmObject*>::iterator it = allParents.begin(); it != allParents.end(); ++it)
{
updateUiSubTree(*it);
}
clearClipboard();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -232,6 +263,7 @@ void RimUiTreeModelPdm::deleteReservoir(RimEclipseCase* reservoir)
clearClipboard();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -62,6 +62,7 @@ public:
RimView* addReservoirView(const std::vector<caf::PdmUiItem*>& treeSelection);
void deleteReservoirViews(const std::vector<caf::PdmUiItem*>& treeSelection);
void deleteGeoMechCases(const std::vector<caf::PdmUiItem*>& treeSelection);
void addInputProperty(const QModelIndex& itemIndex, const QStringList& fileNames);

View File

@@ -204,6 +204,7 @@ void RimUiTreeView::contextMenuEvent(QContextMenuEvent* event)
else if (dynamic_cast<RimGeoMechCase*>(uiItem->dataObject().p()))
{
menu.addAction(QString("New View"), this, SLOT(slotAddView()));
menu.addAction(QString("Close"), this, SLOT(slotCloseGeomechCase()));
}
else if (dynamic_cast<RimEclipseCase*>(uiItem->dataObject().p()))
{
@@ -1616,3 +1617,15 @@ void RimUiTreeView::selectedUiItems(std::vector<caf::PdmUiItem*>& objects)
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimUiTreeView::slotCloseGeomechCase()
{
RimUiTreeModelPdm* myModel = dynamic_cast<RimUiTreeModelPdm*>(model());
std::vector<caf::PdmUiItem*> selection;
this->selectedUiItems(selection);
myModel->deleteGeoMechCases(selection);
}

View File

@@ -83,6 +83,7 @@ private slots:
void slotWriteBinaryResultAsInputProperty();
void slotCloseCase();
void slotCloseGeomechCase();
void slotNewStatisticsCase();
void slotComputeStatistics();