2018-03-12 05:07:46 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2019-01-09 08:21:38 -06:00
|
|
|
// Copyright (C) 2018- Equinor ASA
|
2018-03-14 05:36:15 -05:00
|
|
|
//
|
2018-03-12 05:07:46 -05:00
|
|
|
// 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.
|
2018-03-14 05:36:15 -05:00
|
|
|
//
|
2018-03-12 05:07:46 -05:00
|
|
|
// 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.
|
2018-03-14 05:36:15 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2018-03-12 05:07:46 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RimVirtualPerforationResults.h"
|
|
|
|
|
2018-04-05 06:50:14 -05:00
|
|
|
#include "RimEclipseCase.h"
|
2018-03-14 03:35:48 -05:00
|
|
|
#include "RimEclipseView.h"
|
2018-04-18 03:10:39 -05:00
|
|
|
#include "RimRegularLegendConfig.h"
|
2018-03-12 05:07:46 -05:00
|
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT(RimVirtualPerforationResults, "RimVirtualPerforationResults");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-14 05:36:15 -05:00
|
|
|
///
|
2018-03-12 05:07:46 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimVirtualPerforationResults::RimVirtualPerforationResults()
|
|
|
|
{
|
2018-03-14 05:36:15 -05:00
|
|
|
// clang-format off
|
|
|
|
|
|
|
|
QString connectionFactorUiName = "Well Connection Factors";
|
|
|
|
|
2018-05-07 08:56:23 -05:00
|
|
|
CAF_PDM_InitObject(connectionFactorUiName, ":/WellCF16x16.png", "", "");
|
2018-03-12 05:07:46 -05:00
|
|
|
|
2018-03-15 01:27:48 -05:00
|
|
|
CAF_PDM_InitField(&m_isActive, "ShowConnectionFactors", false, "", "", "", "");
|
2018-04-19 15:28:22 -05:00
|
|
|
CAF_PDM_InitField(&m_showClosedConnections, "ShowClosedConnections", true, "Show On Closed Connections", "", "", "");
|
|
|
|
CAF_PDM_InitField(&m_geometryScaleFactor, "GeometryScaleFactor", 2.0, "Geometry Scale Factor", "", "", "");
|
2018-03-12 05:07:46 -05:00
|
|
|
|
2019-03-29 06:03:09 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_legendConfig, "LegendDefinition", "Color Legend", "", "", "");
|
2018-03-14 03:35:48 -05:00
|
|
|
m_legendConfig.uiCapability()->setUiHidden(true);
|
|
|
|
|
2018-04-18 03:10:39 -05:00
|
|
|
m_legendConfig = new RimRegularLegendConfig();
|
2018-03-14 05:36:15 -05:00
|
|
|
m_legendConfig->setTitle(connectionFactorUiName);
|
|
|
|
|
|
|
|
// clang-format on
|
2018-03-12 05:07:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-14 05:36:15 -05:00
|
|
|
///
|
2018-03-12 05:07:46 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-14 05:36:15 -05:00
|
|
|
RimVirtualPerforationResults::~RimVirtualPerforationResults() {}
|
2018-03-12 05:07:46 -05:00
|
|
|
|
2018-03-14 03:35:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-14 05:36:15 -05:00
|
|
|
///
|
2018-03-14 03:35:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-19 15:28:22 -05:00
|
|
|
bool RimVirtualPerforationResults::showConnectionFactors() const
|
2018-03-14 03:35:48 -05:00
|
|
|
{
|
|
|
|
return m_isActive();
|
|
|
|
}
|
|
|
|
|
2018-04-19 15:28:22 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimVirtualPerforationResults::showConnectionFactorsOnClosedConnections() const
|
|
|
|
{
|
|
|
|
return m_showClosedConnections();
|
|
|
|
}
|
|
|
|
|
2018-03-14 03:35:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-14 05:36:15 -05:00
|
|
|
///
|
2018-03-14 03:35:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
double RimVirtualPerforationResults::geometryScaleFactor() const
|
|
|
|
{
|
|
|
|
return m_geometryScaleFactor();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-14 05:36:15 -05:00
|
|
|
///
|
2018-03-14 03:35:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-18 03:10:39 -05:00
|
|
|
RimRegularLegendConfig* RimVirtualPerforationResults::legendConfig() const
|
2018-03-14 03:35:48 -05:00
|
|
|
{
|
|
|
|
return m_legendConfig();
|
|
|
|
}
|
|
|
|
|
2018-04-05 06:50:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimVirtualPerforationResults::loadData()
|
|
|
|
{
|
|
|
|
RimEclipseCase* eclipseCase = nullptr;
|
|
|
|
this->firstAncestorOrThisOfType(eclipseCase);
|
|
|
|
if (eclipseCase)
|
|
|
|
{
|
|
|
|
eclipseCase->computeAndGetVirtualPerforationTransmissibilities();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-12 05:07:46 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-14 05:36:15 -05:00
|
|
|
///
|
2018-03-12 05:07:46 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-14 05:36:15 -05:00
|
|
|
void RimVirtualPerforationResults::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
|
|
|
const QVariant& oldValue,
|
|
|
|
const QVariant& newValue)
|
2018-03-12 05:07:46 -05:00
|
|
|
{
|
2018-03-14 05:36:15 -05:00
|
|
|
if (changedField == &m_isActive)
|
|
|
|
{
|
|
|
|
updateUiIconFromToggleField();
|
2018-04-05 06:50:14 -05:00
|
|
|
|
|
|
|
loadData();
|
2018-03-14 05:36:15 -05:00
|
|
|
}
|
|
|
|
|
2018-03-14 03:35:48 -05:00
|
|
|
RimEclipseView* eclView = nullptr;
|
|
|
|
this->firstAncestorOrThisOfTypeAsserted(eclView);
|
2018-03-12 05:07:46 -05:00
|
|
|
|
2018-03-14 03:35:48 -05:00
|
|
|
eclView->scheduleCreateDisplayModelAndRedraw();
|
2018-03-12 05:07:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-14 05:36:15 -05:00
|
|
|
///
|
2018-03-12 05:07:46 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
caf::PdmFieldHandle* RimVirtualPerforationResults::objectToggleField()
|
|
|
|
{
|
2018-03-14 03:35:48 -05:00
|
|
|
return &m_isActive;
|
2018-03-12 05:07:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-14 05:36:15 -05:00
|
|
|
///
|
2018-03-12 05:07:46 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimVirtualPerforationResults::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
|
|
|
{
|
2018-03-14 03:35:48 -05:00
|
|
|
uiOrdering.add(&m_geometryScaleFactor);
|
2018-04-19 15:28:22 -05:00
|
|
|
uiOrdering.add(&m_showClosedConnections);
|
2018-03-14 03:35:48 -05:00
|
|
|
|
2018-03-12 05:07:46 -05:00
|
|
|
uiOrdering.skipRemainingFields(true);
|
|
|
|
}
|
|
|
|
|
2018-03-14 05:36:15 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-05 06:50:14 -05:00
|
|
|
///
|
2018-03-14 05:36:15 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimVirtualPerforationResults::initAfterRead()
|
|
|
|
{
|
|
|
|
updateUiIconFromToggleField();
|
|
|
|
}
|