2015-11-18 02:15:13 -06: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 "RimCrossSectionCollection.h"
|
|
|
|
|
2016-09-21 03:48:25 -05:00
|
|
|
#include "RimIntersection.h"
|
2016-07-27 01:05:44 -05:00
|
|
|
#include "RimEclipseWell.h"
|
2015-11-19 06:40:45 -06:00
|
|
|
#include "RimView.h"
|
2015-11-18 02:15:13 -06:00
|
|
|
|
2016-07-27 01:05:44 -05:00
|
|
|
#include "RiuMainWindow.h"
|
|
|
|
|
2016-09-21 03:32:29 -05:00
|
|
|
#include "RivIntersectionPartMgr.h"
|
2016-07-27 01:05:44 -05:00
|
|
|
|
2015-11-18 02:15:13 -06:00
|
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT(RimCrossSectionCollection, "CrossSectionCollection");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimCrossSectionCollection::RimCrossSectionCollection()
|
|
|
|
{
|
2015-11-24 06:26:45 -06:00
|
|
|
CAF_PDM_InitObject("Intersections", ":/CrossSections16x16.png", "", "");
|
2015-11-18 02:15:13 -06:00
|
|
|
|
2015-11-23 02:07:35 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_crossSections, "CrossSections", "Intersections", "", "", "");
|
2015-11-19 06:40:45 -06:00
|
|
|
m_crossSections.uiCapability()->setUiHidden(true);
|
2015-11-18 02:15:13 -06:00
|
|
|
|
|
|
|
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
|
|
|
isActive.uiCapability()->setUiHidden(true);
|
|
|
|
}
|
|
|
|
|
2015-12-03 01:26:38 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimCrossSectionCollection::~RimCrossSectionCollection()
|
|
|
|
{
|
|
|
|
m_crossSections.deleteAllChildObjects();
|
|
|
|
}
|
|
|
|
|
2015-11-18 02:15:13 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
caf::PdmFieldHandle* RimCrossSectionCollection::objectToggleField()
|
|
|
|
{
|
|
|
|
return &isActive;
|
|
|
|
}
|
2015-11-19 04:41:16 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimCrossSectionCollection::applySingleColorEffect()
|
|
|
|
{
|
2015-11-19 06:40:45 -06:00
|
|
|
for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx)
|
2015-11-19 04:41:16 -06:00
|
|
|
{
|
2016-09-21 03:48:25 -05:00
|
|
|
RimIntersection* cs = m_crossSections[csIdx];
|
2015-11-22 08:07:34 -06:00
|
|
|
if (cs->isActive)
|
|
|
|
{
|
|
|
|
cs->crossSectionPartMgr()->applySingleColorEffect();
|
|
|
|
}
|
2015-11-19 04:41:16 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-11-20 08:54:22 -06:00
|
|
|
void RimCrossSectionCollection::updateCellResultColor(size_t timeStepIndex)
|
2015-11-19 04:41:16 -06:00
|
|
|
{
|
2015-11-19 06:40:45 -06:00
|
|
|
for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx)
|
2015-11-19 04:41:16 -06:00
|
|
|
{
|
2016-09-21 03:48:25 -05:00
|
|
|
RimIntersection* cs = m_crossSections[csIdx];
|
2015-11-22 08:07:34 -06:00
|
|
|
if (cs->isActive)
|
|
|
|
{
|
|
|
|
cs->crossSectionPartMgr()->updateCellResultColor(timeStepIndex);
|
|
|
|
}
|
2015-11-19 04:41:16 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimCrossSectionCollection::appendPartsToModel(cvf::ModelBasicList* model, cvf::Transform* scaleTransform)
|
|
|
|
{
|
2015-11-19 11:56:23 -06:00
|
|
|
if (!isActive) return;
|
|
|
|
|
2015-11-19 06:40:45 -06:00
|
|
|
for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx)
|
2015-11-19 04:41:16 -06:00
|
|
|
{
|
2016-09-21 03:48:25 -05:00
|
|
|
RimIntersection* cs = m_crossSections[csIdx];
|
2015-11-19 04:41:16 -06:00
|
|
|
if (cs->isActive)
|
|
|
|
{
|
|
|
|
cs->crossSectionPartMgr()->appendNativeCrossSectionFacesToModel(model, scaleTransform);
|
|
|
|
cs->crossSectionPartMgr()->appendMeshLinePartsToModel(model, scaleTransform);
|
2015-11-30 06:54:56 -06:00
|
|
|
|
|
|
|
if (cs->inputFromViewerEnabled)
|
|
|
|
{
|
|
|
|
cs->crossSectionPartMgr()->appendPolylinePartsToModel(model, scaleTransform);
|
|
|
|
}
|
2015-11-19 04:41:16 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-11-19 06:40:45 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 03:48:25 -05:00
|
|
|
void RimCrossSectionCollection::appendCrossSection(RimIntersection* crossSection)
|
2015-11-19 06:40:45 -06:00
|
|
|
{
|
|
|
|
m_crossSections.push_back(crossSection);
|
|
|
|
|
|
|
|
updateConnectedEditors();
|
2015-12-07 03:07:51 -06:00
|
|
|
RiuMainWindow::instance()->selectAsCurrentItem(crossSection);
|
2015-11-19 06:40:45 -06:00
|
|
|
|
|
|
|
RimView* rimView = NULL;
|
|
|
|
firstAnchestorOrThisOfType(rimView);
|
|
|
|
if (rimView)
|
|
|
|
{
|
|
|
|
rimView->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
|
|
|
}
|
2015-11-19 11:56:23 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimCrossSectionCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
|
|
|
{
|
|
|
|
if (changedField == &isActive)
|
|
|
|
{
|
|
|
|
RimView* rimView = NULL;
|
|
|
|
firstAnchestorOrThisOfType(rimView);
|
|
|
|
if (rimView)
|
|
|
|
{
|
|
|
|
rimView->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-07-27 01:05:44 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimCrossSectionCollection::hasActiveCrossSectionForSimulationWell(RimEclipseWell* eclipseWell) const
|
|
|
|
{
|
|
|
|
if (!isActive) return false;
|
|
|
|
|
|
|
|
for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx)
|
|
|
|
{
|
2016-09-21 03:48:25 -05:00
|
|
|
RimIntersection* cs = m_crossSections[csIdx];
|
2016-07-27 01:05:44 -05:00
|
|
|
|
|
|
|
if (cs->isActive &&
|
2016-09-21 03:48:25 -05:00
|
|
|
cs->type() == RimIntersection::CS_SIMULATION_WELL &&
|
2016-07-27 01:05:44 -05:00
|
|
|
cs->simulationWell() == eclipseWell)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|