Implemented check for any results of statistics cases

p4#: 21148
This commit is contained in:
Magne Sjaastad 2013-04-05 14:39:34 +02:00
parent 5911e2bf32
commit ae812a2bbf
2 changed files with 25 additions and 2 deletions

View File

@ -1029,8 +1029,7 @@ bool RimUiTreeView::userConfirmedGridCaseGroupChange(const QModelIndex & itemInd
RimIdenticalGridCaseGroup* gridCaseGroup = myModel->gridCaseGroupFromItemIndex(itemIndex);
if (gridCaseGroup)
{
// TODO: This test has to check if any of the statistical cases has result values
if (gridCaseGroup->statisticsCaseCollection()->reservoirs.size() > 0)
if (hasAnyStatisticsResults(gridCaseGroup))
{
RiuMainWindow* mainWnd = RiuMainWindow::instance();
@ -1052,3 +1051,25 @@ bool RimUiTreeView::userConfirmedGridCaseGroupChange(const QModelIndex & itemInd
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimUiTreeView::hasAnyStatisticsResults(RimIdenticalGridCaseGroup* gridCaseGroup)
{
CVF_ASSERT(gridCaseGroup);
for (size_t i = 0; i < gridCaseGroup->statisticsCaseCollection()->reservoirs().size(); i++)
{
RimStatisticsCase* rimStaticsCase = dynamic_cast<RimStatisticsCase*>(gridCaseGroup->statisticsCaseCollection()->reservoirs[i]);
if (rimStaticsCase)
{
if (rimStaticsCase->hasComputedStatistics())
{
return true;
}
}
}
return false;
}

View File

@ -23,6 +23,7 @@
#include <QTreeView>
class QItemSelection;
class RimIdenticalGridCaseGroup;
namespace caf {
class PdmObjectGroup;
@ -90,6 +91,7 @@ signals:
private:
bool userConfirmedGridCaseGroupChange(const QModelIndex & itemIndex);
bool hasAnyStatisticsResults(RimIdenticalGridCaseGroup* gridCaseGroup);
void createPdmObjectsFromClipboard(caf::PdmObjectGroup* objectGroup);
bool hasClipboardValidData();