2015-08-11 08:33:06 -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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-08-17 06:32:50 -05:00
|
|
|
#include "RicGeoMechPropertyFilterImpl.h"
|
2015-08-11 08:33:06 -05:00
|
|
|
|
|
|
|
#include "RimGeoMechPropertyFilter.h"
|
|
|
|
#include "RimGeoMechPropertyFilterCollection.h"
|
|
|
|
#include "RimGeoMechView.h"
|
|
|
|
#include "RimGeoMechResultDefinition.h"
|
|
|
|
#include "RimGeoMechCellColors.h"
|
|
|
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include "cvfAssert.h"
|
2015-08-13 16:47:04 -05:00
|
|
|
#include "RiuMainWindow.h"
|
2015-08-11 08:33:06 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-17 06:32:50 -05:00
|
|
|
std::vector<RimGeoMechPropertyFilter*> RicGeoMechPropertyFilterImpl::selectedPropertyFilters()
|
2015-08-11 08:33:06 -05:00
|
|
|
{
|
|
|
|
std::vector<RimGeoMechPropertyFilter*> propertyFilters;
|
|
|
|
caf::SelectionManager::instance()->objectsByType(&propertyFilters);
|
|
|
|
|
|
|
|
return propertyFilters;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-17 06:32:50 -05:00
|
|
|
std::vector<RimGeoMechPropertyFilterCollection*> RicGeoMechPropertyFilterImpl::selectedPropertyFilterCollections()
|
2015-08-11 08:33:06 -05:00
|
|
|
{
|
|
|
|
std::vector<RimGeoMechPropertyFilterCollection*> propertyFilterCollections;
|
|
|
|
caf::SelectionManager::instance()->objectsByType(&propertyFilterCollections);
|
|
|
|
|
|
|
|
return propertyFilterCollections;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-17 06:32:50 -05:00
|
|
|
void RicGeoMechPropertyFilterImpl::addPropertyFilter(RimGeoMechPropertyFilterCollection* propertyFilterCollection)
|
2015-08-11 08:33:06 -05:00
|
|
|
{
|
|
|
|
RimGeoMechPropertyFilter* propertyFilter = createPropertyFilter(propertyFilterCollection);
|
|
|
|
CVF_ASSERT(propertyFilter);
|
|
|
|
|
|
|
|
propertyFilterCollection->propertyFilters.push_back(propertyFilter);
|
|
|
|
propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED);
|
|
|
|
|
|
|
|
propertyFilterCollection->updateConnectedEditors();
|
2015-08-13 16:47:04 -05:00
|
|
|
RiuMainWindow::instance()->setCurrentObjectInTreeView(propertyFilter);
|
|
|
|
|
2015-08-11 08:33:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-17 06:32:50 -05:00
|
|
|
void RicGeoMechPropertyFilterImpl::insertPropertyFilter(RimGeoMechPropertyFilterCollection* propertyFilterCollection, size_t index)
|
2015-08-11 08:33:06 -05:00
|
|
|
{
|
|
|
|
RimGeoMechPropertyFilter* propertyFilter = createPropertyFilter(propertyFilterCollection);
|
|
|
|
CVF_ASSERT(propertyFilter);
|
|
|
|
|
|
|
|
propertyFilterCollection->propertyFilters.insertAt(index, propertyFilter);
|
|
|
|
propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED);
|
|
|
|
|
|
|
|
propertyFilterCollection->updateConnectedEditors();
|
2015-08-13 16:47:04 -05:00
|
|
|
RiuMainWindow::instance()->setCurrentObjectInTreeView(propertyFilter);
|
|
|
|
|
2015-08-11 08:33:06 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-17 06:32:50 -05:00
|
|
|
RimGeoMechPropertyFilter* RicGeoMechPropertyFilterImpl::createPropertyFilter(RimGeoMechPropertyFilterCollection* propertyFilterCollection)
|
2015-08-11 08:33:06 -05:00
|
|
|
{
|
|
|
|
CVF_ASSERT(propertyFilterCollection);
|
|
|
|
|
|
|
|
RimGeoMechPropertyFilter* propertyFilter = new RimGeoMechPropertyFilter();
|
|
|
|
propertyFilter->setParentContainer(propertyFilterCollection);
|
|
|
|
|
|
|
|
setDefaults(propertyFilter);
|
|
|
|
|
|
|
|
return propertyFilter;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-17 06:32:50 -05:00
|
|
|
void RicGeoMechPropertyFilterImpl::setDefaults(RimGeoMechPropertyFilter* propertyFilter)
|
2015-08-11 08:33:06 -05:00
|
|
|
{
|
|
|
|
CVF_ASSERT(propertyFilter);
|
|
|
|
|
|
|
|
RimGeoMechPropertyFilterCollection* propertyFilterCollection = propertyFilter->parentContainer();
|
|
|
|
CVF_ASSERT(propertyFilterCollection);
|
|
|
|
|
|
|
|
RimGeoMechView* reservoirView = propertyFilterCollection->reservoirView();
|
|
|
|
CVF_ASSERT(reservoirView);
|
|
|
|
|
|
|
|
propertyFilter->resultDefinition->setReservoirView(reservoirView);
|
|
|
|
propertyFilter->resultDefinition->setResultAddress(reservoirView->cellResult()->resultAddress());
|
|
|
|
propertyFilter->resultDefinition->loadResult();
|
|
|
|
propertyFilter->setToDefaultValues();
|
|
|
|
propertyFilter->updateFilterName();
|
|
|
|
}
|