2015-06-19 07:09:45 -05: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 "RimGeoMechPropertyFilterCollection.h"
|
|
|
|
#include "RimGeoMechPropertyFilter.h"
|
|
|
|
#include "RimGeoMechView.h"
|
2015-06-25 06:32:00 -05:00
|
|
|
#include "RimGeoMechCellColors.h"
|
2015-06-19 07:09:45 -05:00
|
|
|
|
|
|
|
#include "cvfAssert.h"
|
|
|
|
|
|
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT(RimGeoMechPropertyFilterCollection, "GeoMechPropertyFilters");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimGeoMechPropertyFilterCollection::RimGeoMechPropertyFilterCollection()
|
|
|
|
{
|
2015-08-24 10:26:22 -05:00
|
|
|
CAF_PDM_InitObject("Property Filters", ":/CellFilter_Values.png", "", "");
|
2015-06-19 07:09:45 -05:00
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&propertyFilters, "PropertyFilters", "Property Filters", "", "", "");
|
2015-08-11 08:23:57 -05:00
|
|
|
propertyFilters.uiCapability()->setUiHidden(true);
|
|
|
|
|
2015-06-19 07:09:45 -05:00
|
|
|
CAF_PDM_InitField(&active, "Active", true, "Active", "", "", "");
|
2015-08-05 06:27:36 -05:00
|
|
|
active.uiCapability()->setUiHidden(true);
|
2015-06-19 07:09:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimGeoMechPropertyFilterCollection::~RimGeoMechPropertyFilterCollection()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechPropertyFilterCollection::setReservoirView(RimGeoMechView* reservoirView)
|
|
|
|
{
|
|
|
|
m_reservoirView = reservoirView;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < propertyFilters.size(); i++)
|
|
|
|
{
|
|
|
|
RimGeoMechPropertyFilter* propertyFilter = propertyFilters[i];
|
|
|
|
propertyFilter->resultDefinition->setReservoirView(m_reservoirView.p());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimGeoMechView* RimGeoMechPropertyFilterCollection::reservoirView()
|
|
|
|
{
|
|
|
|
CVF_ASSERT(!m_reservoirView.isNull());
|
|
|
|
return m_reservoirView;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechPropertyFilterCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
|
|
|
{
|
|
|
|
this->updateUiIconFromToggleField();
|
|
|
|
|
|
|
|
((RimView*)m_reservoirView)->scheduleGeometryRegen(PROPERTY_FILTERED);
|
|
|
|
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimGeoMechPropertyFilter* RimGeoMechPropertyFilterCollection::createAndAppendPropertyFilter()
|
|
|
|
{
|
|
|
|
RimGeoMechPropertyFilter* propertyFilter = new RimGeoMechPropertyFilter();
|
|
|
|
|
|
|
|
propertyFilter->resultDefinition->setReservoirView(m_reservoirView.p());
|
|
|
|
|
|
|
|
propertyFilter->setParentContainer(this);
|
|
|
|
propertyFilters.push_back(propertyFilter);
|
|
|
|
|
|
|
|
propertyFilter->resultDefinition->setResultAddress(m_reservoirView->cellResult()->resultAddress());
|
|
|
|
propertyFilter->resultDefinition->loadResult();
|
2015-06-24 08:03:55 -05:00
|
|
|
propertyFilter->setToDefaultValues();
|
2015-07-02 05:49:28 -05:00
|
|
|
propertyFilter->updateFilterName();
|
|
|
|
|
2015-06-19 07:09:45 -05:00
|
|
|
return propertyFilter;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechPropertyFilterCollection::loadAndInitializePropertyFilters()
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < propertyFilters.size(); i++)
|
|
|
|
{
|
|
|
|
RimGeoMechPropertyFilter* propertyFilter = propertyFilters[i];
|
|
|
|
|
|
|
|
propertyFilter->resultDefinition->loadResult();
|
|
|
|
propertyFilter->computeResultValueRange();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechPropertyFilterCollection::initAfterRead()
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < propertyFilters.size(); i++)
|
|
|
|
{
|
|
|
|
RimGeoMechPropertyFilter* propertyFilter = propertyFilters[i];
|
|
|
|
|
|
|
|
propertyFilter->setParentContainer(this);
|
|
|
|
propertyFilter->resultDefinition->setReservoirView(m_reservoirView.p());
|
|
|
|
propertyFilter->updateIconState();
|
|
|
|
}
|
|
|
|
|
|
|
|
this->updateUiIconFromToggleField();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechPropertyFilterCollection::remove(RimGeoMechPropertyFilter* propertyFilter)
|
|
|
|
{
|
|
|
|
propertyFilters.removeChildObject(propertyFilter);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimGeoMechPropertyFilterCollection::hasActiveFilters() const
|
|
|
|
{
|
|
|
|
if (!active) return false;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < propertyFilters.size(); i++)
|
|
|
|
{
|
|
|
|
RimGeoMechPropertyFilter* propertyFilter = propertyFilters[i];
|
|
|
|
if (propertyFilter->isActive() && propertyFilter->resultDefinition->hasResult()) return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Returns whether any of the active property filters are based on a dynamic result
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimGeoMechPropertyFilterCollection::hasActiveDynamicFilters() const
|
|
|
|
{
|
|
|
|
return hasActiveFilters();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
caf::PdmFieldHandle* RimGeoMechPropertyFilterCollection::objectToggleField()
|
|
|
|
{
|
|
|
|
return &active;
|
|
|
|
}
|