2015-05-15 18:51:49 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
|
|
|
|
//
|
|
|
|
|
// 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 "RimCase.h"
|
2015-11-16 07:16:30 +01:00
|
|
|
|
2016-08-24 15:19:39 +02:00
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
#include "RimFormationNames.h"
|
2017-08-11 07:34:54 +02:00
|
|
|
#include "RimFormationNamesCollection.h"
|
|
|
|
|
#include "RimOilField.h"
|
|
|
|
|
#include "RimProject.h"
|
|
|
|
|
#include "RimTimeStepFilter.h"
|
|
|
|
|
|
|
|
|
|
#include "cafPdmObjectFactory.h"
|
|
|
|
|
|
2018-01-17 08:00:36 +01:00
|
|
|
#include "Rim2dIntersectionView.h"
|
2018-01-23 14:23:28 +01:00
|
|
|
#include "Rim2dIntersectionViewCollection.h"
|
2018-01-17 11:05:31 +01:00
|
|
|
#include "RimIntersection.h"
|
2018-02-05 13:23:44 +01:00
|
|
|
#include "RimGridView.h"
|
2018-01-17 08:00:36 +01:00
|
|
|
|
2015-05-15 18:51:49 +02:00
|
|
|
|
2015-09-25 15:09:19 +02:00
|
|
|
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimCase, "RimCase");
|
2015-05-15 18:51:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-17 08:00:36 +01:00
|
|
|
RimCase::RimCase() : m_isInActiveDestruction(false)
|
2015-05-15 18:51:49 +02:00
|
|
|
{
|
2017-04-06 18:37:43 +02:00
|
|
|
CAF_PDM_InitField(&caseUserDescription, "CaseUserDescription", QString(), "Case Name", "", "" ,"");
|
2015-05-15 18:51:49 +02:00
|
|
|
|
|
|
|
|
CAF_PDM_InitField(&caseId, "CaseId", -1, "Case ID", "", "" ,"");
|
2015-08-05 13:27:36 +02:00
|
|
|
caseId.uiCapability()->setUiReadOnly(true);
|
2015-05-15 18:51:49 +02:00
|
|
|
|
2016-08-24 15:19:39 +02:00
|
|
|
CAF_PDM_InitFieldNoDefault(&activeFormationNames, "DefaultFormationNames", "Formation Names File", "", "", "");
|
2017-08-11 07:34:54 +02:00
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_timeStepFilter, "TimeStepFilter", "Time Step Filter", "", "", "");
|
|
|
|
|
m_timeStepFilter.uiCapability()->setUiHidden(true);
|
|
|
|
|
m_timeStepFilter.uiCapability()->setUiTreeChildrenHidden(true);
|
|
|
|
|
m_timeStepFilter = new RimTimeStepFilter;
|
2018-01-17 08:00:36 +01:00
|
|
|
|
2018-01-23 14:23:28 +01:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_2dIntersectionViewCollection, "IntersectionViewCollection", "2D Intersection Views", ":/CrossSections16x16.png", "", "");
|
|
|
|
|
m_2dIntersectionViewCollection.uiCapability()->setUiTreeHidden(true);
|
|
|
|
|
m_2dIntersectionViewCollection = new Rim2dIntersectionViewCollection();
|
2015-05-15 18:51:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
RimCase::~RimCase()
|
|
|
|
|
{
|
2018-01-17 08:00:36 +01:00
|
|
|
m_isInActiveDestruction = true; // Needed because destruction of m_intersectionViews results in call to views()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<Rim3dView*> RimCase::views() const
|
|
|
|
|
{
|
|
|
|
|
if (m_isInActiveDestruction) return std::vector<Rim3dView*>();
|
|
|
|
|
|
|
|
|
|
std::vector<Rim3dView*> allViews = this->allSpecialViews();
|
2018-01-23 14:23:28 +01:00
|
|
|
std::vector<Rim2dIntersectionView*> isectViews = m_2dIntersectionViewCollection->views();
|
|
|
|
|
|
|
|
|
|
for (auto view: isectViews)
|
2018-01-17 08:00:36 +01:00
|
|
|
{
|
|
|
|
|
allViews.push_back(view);
|
|
|
|
|
}
|
2015-05-15 18:51:49 +02:00
|
|
|
|
2018-01-17 08:00:36 +01:00
|
|
|
return allViews;
|
2015-05-15 18:51:49 +02:00
|
|
|
}
|
|
|
|
|
|
2018-02-05 13:23:44 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
std::vector<RimGridView*> RimCase::gridViews() const
|
|
|
|
|
{
|
|
|
|
|
std::vector<RimGridView*> grViews;
|
|
|
|
|
|
|
|
|
|
for (Rim3dView* const view : views())
|
|
|
|
|
{
|
|
|
|
|
RimGridView* grView = dynamic_cast<RimGridView*>(view);
|
|
|
|
|
if (grView) grViews.push_back(grView);
|
|
|
|
|
}
|
|
|
|
|
return grViews;
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-16 07:16:30 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
cvf::Vec3d RimCase::displayModelOffset() const
|
|
|
|
|
{
|
|
|
|
|
return cvf::Vec3d::ZERO;
|
|
|
|
|
}
|
2016-08-24 15:19:39 +02:00
|
|
|
|
2017-12-01 13:24:43 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RimCase::setFormationNames(RimFormationNames* formationNames)
|
|
|
|
|
{
|
|
|
|
|
activeFormationNames = formationNames;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-19 09:57:10 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
size_t RimCase::uiToNativeTimeStepIndex(size_t uiTimeStepIndex)
|
|
|
|
|
{
|
2018-06-11 13:47:21 +02:00
|
|
|
std::vector<size_t> nativeTimeIndices = m_timeStepFilter->filteredTimeSteps();
|
2017-10-19 09:57:10 +02:00
|
|
|
|
2017-10-20 12:09:25 +02:00
|
|
|
if (nativeTimeIndices.size() > 0)
|
|
|
|
|
{
|
|
|
|
|
return nativeTimeIndices.at(uiTimeStepIndex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return uiTimeStepIndex;
|
2017-10-19 09:57:10 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 11:05:31 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-01-23 14:23:28 +01:00
|
|
|
Rim2dIntersectionViewCollection* RimCase::intersectionViewCollection()
|
2018-01-17 11:05:31 +01:00
|
|
|
{
|
2018-01-23 14:23:28 +01:00
|
|
|
return m_2dIntersectionViewCollection;
|
2018-01-17 11:05:31 +01:00
|
|
|
}
|
|
|
|
|
|
2016-08-24 15:19:39 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
QList<caf::PdmOptionItemInfo> RimCase::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
|
|
|
|
{
|
2017-01-05 07:57:37 +01:00
|
|
|
QList<caf::PdmOptionItemInfo> options;
|
2016-08-24 15:19:39 +02:00
|
|
|
|
|
|
|
|
if(fieldNeedingOptions == &activeFormationNames)
|
|
|
|
|
{
|
|
|
|
|
RimProject* proj = RiaApplication::instance()->project();
|
|
|
|
|
if (proj && proj->activeOilField() && proj->activeOilField()->formationNamesCollection())
|
|
|
|
|
{
|
|
|
|
|
for(RimFormationNames* fnames : proj->activeOilField()->formationNamesCollection()->formationNamesList())
|
|
|
|
|
{
|
2017-01-05 07:57:37 +01:00
|
|
|
options.push_back(caf::PdmOptionItemInfo(fnames->fileNameWoPath(), fnames, false, fnames->uiCapability()->uiIcon()));
|
2016-08-24 15:19:39 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-05 07:57:37 +01:00
|
|
|
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
|
2016-08-24 15:19:39 +02:00
|
|
|
}
|
|
|
|
|
|
2017-01-05 07:57:37 +01:00
|
|
|
return options;
|
2016-08-24 15:19:39 +02:00
|
|
|
}
|