2012-05-18 02:45:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2014-09-23 08:04:57 -05:00
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
2012-05-18 02:45:23 -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.
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-06-25 06:05:28 -05:00
|
|
|
#include "RimEclipsePropertyFilterCollection.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2015-06-25 06:32:00 -05:00
|
|
|
#include "RimEclipseCellColors.h"
|
2017-02-13 07:29:02 -06:00
|
|
|
#include "RimEclipsePropertyFilter.h"
|
2015-08-27 08:45:22 -05:00
|
|
|
#include "RimEclipseResultDefinition.h"
|
|
|
|
#include "RimEclipseView.h"
|
2015-10-13 03:24:11 -05:00
|
|
|
#include "RimViewController.h"
|
2015-09-07 07:29:46 -05:00
|
|
|
#include "RimViewLinker.h"
|
2013-05-06 03:55:00 -05:00
|
|
|
|
2015-08-12 04:09:35 -05:00
|
|
|
#include "cafPdmUiEditorHandle.h"
|
|
|
|
|
|
|
|
|
2015-06-25 04:48:24 -05:00
|
|
|
CAF_PDM_SOURCE_INIT(RimEclipsePropertyFilterCollection, "CellPropertyFilters");
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 04:48:24 -05:00
|
|
|
RimEclipsePropertyFilterCollection::RimEclipsePropertyFilterCollection()
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2015-08-10 01:00:16 -05:00
|
|
|
CAF_PDM_InitObject("Property Filters", ":/CellFilter_Values.png", "", "");
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&propertyFilters, "PropertyFilters", "Property Filters", "", "", "");
|
2015-08-10 01:00:16 -05:00
|
|
|
propertyFilters.uiCapability()->setUiHidden(true);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 04:48:24 -05:00
|
|
|
RimEclipsePropertyFilterCollection::~RimEclipsePropertyFilterCollection()
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2015-12-09 06:52:25 -06:00
|
|
|
propertyFilters.deleteAllChildObjects();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 04:48:24 -05:00
|
|
|
RimEclipseView* RimEclipsePropertyFilterCollection::reservoirView()
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2015-08-27 08:16:47 -05:00
|
|
|
RimEclipseView* eclipseView = NULL;
|
2016-09-21 06:59:41 -05:00
|
|
|
firstAncestorOrThisOfType(eclipseView);
|
2015-08-27 08:16:47 -05:00
|
|
|
|
|
|
|
return eclipseView;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 04:48:24 -05:00
|
|
|
void RimEclipsePropertyFilterCollection::loadAndInitializePropertyFilters()
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2015-06-18 04:23:56 -05:00
|
|
|
for (size_t i = 0; i < propertyFilters.size(); i++)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2015-06-25 04:45:31 -05:00
|
|
|
RimEclipsePropertyFilter* propertyFilter = propertyFilters[i];
|
2017-04-20 09:21:48 -05:00
|
|
|
propertyFilter->resultDefinition->setEclipseCase(reservoirView()->eclipseCase());
|
2015-08-12 04:09:35 -05:00
|
|
|
propertyFilter->initAfterRead();
|
2017-04-20 09:21:48 -05:00
|
|
|
propertyFilter->resultDefinition->loadResult();
|
|
|
|
propertyFilter->computeResultValueRange();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 04:48:24 -05:00
|
|
|
void RimEclipsePropertyFilterCollection::initAfterRead()
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2015-09-23 07:35:35 -05:00
|
|
|
updateIconState();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 04:48:24 -05:00
|
|
|
bool RimEclipsePropertyFilterCollection::hasActiveFilters() const
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2015-09-23 07:35:35 -05:00
|
|
|
if (!isActive) return false;
|
2013-04-25 03:57:52 -05:00
|
|
|
|
2015-06-18 04:23:56 -05:00
|
|
|
for (size_t i = 0; i < propertyFilters.size(); i++)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2015-06-25 04:45:31 -05:00
|
|
|
RimEclipsePropertyFilter* propertyFilter = propertyFilters[i];
|
2015-06-18 04:23:56 -05:00
|
|
|
if (propertyFilter->isActive() && propertyFilter->resultDefinition->hasResult()) return true;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Returns whether any of the active property filters are based on a dynamic result
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 04:48:24 -05:00
|
|
|
bool RimEclipsePropertyFilterCollection::hasActiveDynamicFilters() const
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2015-09-23 07:35:35 -05:00
|
|
|
if (!isActive) return false;
|
2013-04-25 03:57:52 -05:00
|
|
|
|
2015-06-18 04:23:56 -05:00
|
|
|
for (size_t i = 0; i < propertyFilters.size(); i++)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2015-06-25 04:45:31 -05:00
|
|
|
RimEclipsePropertyFilter* propertyFilter = propertyFilters[i];
|
2015-06-18 04:23:56 -05:00
|
|
|
if (propertyFilter->isActive() && propertyFilter->resultDefinition->hasDynamicResult()) return true;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2013-04-25 03:57:52 -05:00
|
|
|
|
2015-09-23 07:35:35 -05:00
|
|
|
|
2016-11-04 02:08:55 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimEclipsePropertyFilterCollection::isUsingFormationNames() const
|
|
|
|
{
|
|
|
|
if ( !isActive ) return false;
|
|
|
|
|
|
|
|
for ( size_t i = 0; i < propertyFilters.size(); i++ )
|
|
|
|
{
|
|
|
|
RimEclipsePropertyFilter* propertyFilter = propertyFilters[i];
|
|
|
|
if ( propertyFilter->isActive()
|
2017-06-13 08:41:52 -05:00
|
|
|
&& propertyFilter->resultDefinition->resultType() == RiaDefines::FORMATION_NAMES
|
|
|
|
&& propertyFilter->resultDefinition->resultVariable() != RiaDefines::undefinedResultName()) return true;
|
2016-11-04 02:08:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-09-23 07:35:35 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEclipsePropertyFilterCollection::updateIconState()
|
|
|
|
{
|
|
|
|
bool activeIcon = true;
|
2015-08-27 08:45:22 -05:00
|
|
|
|
2015-09-23 07:35:35 -05:00
|
|
|
RimEclipseView* view = NULL;
|
2016-09-21 06:59:41 -05:00
|
|
|
this->firstAncestorOrThisOfType(view);
|
2017-02-24 09:00:56 -06:00
|
|
|
if (view)
|
2015-09-23 07:35:35 -05:00
|
|
|
{
|
2017-02-24 09:00:56 -06:00
|
|
|
RimViewController* viewController = view->viewController();
|
|
|
|
if (viewController && (viewController->isPropertyFilterOveridden()
|
|
|
|
|| viewController->isVisibleCellsOveridden()))
|
|
|
|
{
|
|
|
|
activeIcon = false;
|
|
|
|
}
|
2015-09-23 07:35:35 -05:00
|
|
|
}
|
2015-09-01 10:14:22 -05:00
|
|
|
|
2015-09-23 07:35:35 -05:00
|
|
|
if (!isActive)
|
2015-09-01 10:14:22 -05:00
|
|
|
{
|
2015-09-23 07:35:35 -05:00
|
|
|
activeIcon = false;
|
2015-09-01 10:14:22 -05:00
|
|
|
}
|
2015-09-23 07:35:35 -05:00
|
|
|
|
|
|
|
updateUiIconFromState(activeIcon);
|
|
|
|
|
2015-11-02 02:30:04 -06:00
|
|
|
for (size_t i = 0; i < propertyFilters.size(); i++)
|
|
|
|
{
|
|
|
|
RimEclipsePropertyFilter* cellFilter = propertyFilters[i];
|
|
|
|
cellFilter->updateActiveState();
|
|
|
|
cellFilter->updateIconState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-14 11:26:40 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEclipsePropertyFilterCollection::updateFromCurrentTimeStep()
|
|
|
|
{
|
|
|
|
for (RimEclipsePropertyFilter* cellFilter : propertyFilters())
|
|
|
|
{
|
|
|
|
cellFilter->updateFromCurrentTimeStep();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|