///////////////////////////////////////////////////////////////////////////////// // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RicEclipsePropertyFilterFeatureImpl.h" #include "RimEclipsePropertyFilter.h" #include "RimEclipsePropertyFilterCollection.h" #include "RimEclipseView.h" #include "RimEclipseResultDefinition.h" #include "RimEclipseCellColors.h" #include "cafSelectionManager.h" #include "cvfAssert.h" #include "RiuMainWindow.h" //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector RicEclipsePropertyFilterFeatureImpl::selectedPropertyFilters() { std::vector propertyFilters; caf::SelectionManager::instance()->objectsByType(&propertyFilters); return propertyFilters; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- std::vector RicEclipsePropertyFilterFeatureImpl::selectedPropertyFilterCollections() { std::vector propertyFilterCollections; caf::SelectionManager::instance()->objectsByType(&propertyFilterCollections); return propertyFilterCollections; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicEclipsePropertyFilterFeatureImpl::addPropertyFilter(RimEclipsePropertyFilterCollection* propertyFilterCollection) { RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter(); propertyFilterCollection->propertyFilters.push_back(propertyFilter); setDefaults(propertyFilter); propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED); propertyFilterCollection->updateConnectedEditors(); RiuMainWindow::instance()->setCurrentObjectInTreeView(propertyFilter); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicEclipsePropertyFilterFeatureImpl::insertPropertyFilter(RimEclipsePropertyFilterCollection* propertyFilterCollection, size_t index) { RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter(); propertyFilterCollection->propertyFilters.insertAt(static_cast(index), propertyFilter); setDefaults(propertyFilter); propertyFilterCollection->reservoirView()->scheduleGeometryRegen(PROPERTY_FILTERED); propertyFilterCollection->updateConnectedEditors(); RiuMainWindow::instance()->setCurrentObjectInTreeView(propertyFilter); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RicEclipsePropertyFilterFeatureImpl::setDefaults(RimEclipsePropertyFilter* propertyFilter) { CVF_ASSERT(propertyFilter); RimEclipsePropertyFilterCollection* propertyFilterCollection = propertyFilter->parentContainer(); CVF_ASSERT(propertyFilterCollection); RimEclipseView* reservoirView = propertyFilterCollection->reservoirView(); CVF_ASSERT(reservoirView); propertyFilter->resultDefinition->setEclipseCase(reservoirView->eclipseCase()); propertyFilter->resultDefinition->setResultVariable(reservoirView->cellResult->resultVariable()); propertyFilter->resultDefinition->setPorosityModel(reservoirView->cellResult->porosityModel()); propertyFilter->resultDefinition->setResultType(reservoirView->cellResult->resultType()); propertyFilter->resultDefinition->loadResult(); propertyFilter->setToDefaultValues(); propertyFilter->updateFilterName(); }