2015-08-25 05:40:55 -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 "RimManagedViewCollection.h"
|
|
|
|
|
|
|
|
#include "RimEclipseCellColors.h"
|
|
|
|
#include "RimEclipseResultDefinition.h"
|
|
|
|
#include "RimEclipseView.h"
|
|
|
|
#include "RimManagedViewConfig.h"
|
|
|
|
#include "RimView.h"
|
|
|
|
|
|
|
|
#include "RiuViewer.h"
|
|
|
|
|
|
|
|
#include "cvfCamera.h"
|
|
|
|
#include "cvfMatrix4.h"
|
2015-08-27 07:57:04 -05:00
|
|
|
#include "RimGeoMechView.h"
|
|
|
|
#include "RimGeoMechResultDefinition.h"
|
|
|
|
#include "RimGeoMechCellColors.h"
|
2015-08-25 05:40:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT(RimManagedViewCollection, "RimManagedViewCollection");
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimManagedViewCollection::RimManagedViewCollection(void)
|
|
|
|
{
|
|
|
|
CAF_PDM_InitObject("Managed Views", ":/chain.png", "", "");
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&managedViews, "ManagedViews", "Managed Views", "", "", "");
|
|
|
|
managedViews.uiCapability()->setUiHidden(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimManagedViewCollection::~RimManagedViewCollection(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimManagedViewCollection::updateTimeStep(int timeStep)
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < managedViews.size(); i++)
|
|
|
|
{
|
|
|
|
RimManagedViewConfig* managedViewConfig = managedViews[i];
|
|
|
|
if (managedViewConfig->managedView())
|
|
|
|
{
|
|
|
|
if (managedViewConfig->syncTimeStep() && managedViewConfig->managedView()->viewer())
|
|
|
|
{
|
|
|
|
managedViewConfig->managedView()->viewer()->slotSetCurrentFrame(timeStep);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-08-27 07:57:04 -05:00
|
|
|
void RimManagedViewCollection::updateCellResult()
|
2015-08-25 05:40:55 -05:00
|
|
|
{
|
2015-08-27 07:57:04 -05:00
|
|
|
RimView* masterView = NULL;
|
|
|
|
firstAnchestorOrThisOfType(masterView);
|
|
|
|
|
|
|
|
RimEclipseView* masterEclipseView = dynamic_cast<RimEclipseView*>(masterView);
|
|
|
|
if (masterEclipseView && masterEclipseView->cellResult())
|
2015-08-25 05:40:55 -05:00
|
|
|
{
|
2015-08-27 07:57:04 -05:00
|
|
|
RimEclipseResultDefinition* eclipseCellResultDefinition = masterEclipseView->cellResult();
|
|
|
|
|
|
|
|
for (size_t i = 0; i < managedViews.size(); i++)
|
2015-08-25 05:40:55 -05:00
|
|
|
{
|
2015-08-27 07:57:04 -05:00
|
|
|
RimManagedViewConfig* managedViewConfig = managedViews[i];
|
|
|
|
if (managedViewConfig->managedView())
|
2015-08-25 05:40:55 -05:00
|
|
|
{
|
2015-08-27 07:57:04 -05:00
|
|
|
if (managedViewConfig->syncCellResult())
|
|
|
|
{
|
|
|
|
RimView* rimView = managedViewConfig->managedView();
|
|
|
|
RimEclipseView* eclipeView = dynamic_cast<RimEclipseView*>(rimView);
|
|
|
|
if (eclipeView)
|
|
|
|
{
|
|
|
|
eclipeView->cellResult()->setPorosityModel(eclipseCellResultDefinition->porosityModel());
|
|
|
|
eclipeView->cellResult()->setResultType(eclipseCellResultDefinition->resultType());
|
|
|
|
eclipeView->cellResult()->setResultVariable(eclipseCellResultDefinition->resultVariable());
|
|
|
|
}
|
|
|
|
}
|
2015-08-28 01:01:40 -05:00
|
|
|
|
|
|
|
// Notify recursively
|
|
|
|
managedViewConfig->managedView()->managedViewCollection()->updateCellResult();
|
2015-08-27 07:57:04 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RimGeoMechView* masterGeoView = dynamic_cast<RimGeoMechView*>(masterView);
|
|
|
|
if (masterGeoView && masterGeoView->cellResult())
|
|
|
|
{
|
|
|
|
RimGeoMechResultDefinition* geoMechResultDefinition = masterGeoView->cellResult();
|
|
|
|
|
|
|
|
for (size_t i = 0; i < managedViews.size(); i++)
|
|
|
|
{
|
|
|
|
RimManagedViewConfig* managedViewConfig = managedViews[i];
|
|
|
|
if (managedViewConfig->managedView())
|
|
|
|
{
|
|
|
|
if (managedViewConfig->syncCellResult())
|
2015-08-25 05:40:55 -05:00
|
|
|
{
|
2015-08-27 07:57:04 -05:00
|
|
|
RimView* rimView = managedViewConfig->managedView();
|
|
|
|
RimGeoMechView* geoView = dynamic_cast<RimGeoMechView*>(rimView);
|
|
|
|
if (geoView)
|
|
|
|
{
|
|
|
|
geoView->cellResult()->setResultAddress(geoMechResultDefinition->resultAddress());
|
|
|
|
geoView->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
2015-08-25 05:40:55 -05:00
|
|
|
}
|
2015-08-28 01:01:40 -05:00
|
|
|
|
|
|
|
// Notify recursively
|
|
|
|
managedViewConfig->managedView()->managedViewCollection()->updateCellResult();
|
2015-08-25 05:40:55 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-08-27 06:44:27 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimManagedViewCollection::updateRangeFilters()
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < managedViews.size(); i++)
|
|
|
|
{
|
|
|
|
RimManagedViewConfig* managedViewConfig = managedViews[i];
|
|
|
|
if (managedViewConfig->managedView())
|
|
|
|
{
|
|
|
|
if (managedViewConfig->syncRangeFilters())
|
|
|
|
{
|
|
|
|
RimView* rimView = managedViewConfig->managedView();
|
|
|
|
RimEclipseView* eclipeView = dynamic_cast<RimEclipseView*>(rimView);
|
|
|
|
if (eclipeView)
|
|
|
|
{
|
|
|
|
eclipeView->scheduleGeometryRegen(RANGE_FILTERED);
|
|
|
|
eclipeView->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
|
|
|
|
|
|
|
|
eclipeView->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
2015-08-27 07:57:04 -05:00
|
|
|
|
|
|
|
RimGeoMechView* geoView = dynamic_cast<RimGeoMechView*>(rimView);
|
|
|
|
if (geoView)
|
|
|
|
{
|
|
|
|
geoView->scheduleGeometryRegen(RANGE_FILTERED);
|
|
|
|
geoView->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
|
|
|
|
|
|
|
|
geoView->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
2015-08-27 06:44:27 -05:00
|
|
|
}
|
2015-08-28 01:01:40 -05:00
|
|
|
|
|
|
|
// Notify recursively
|
|
|
|
managedViewConfig->managedView()->managedViewCollection()->updateRangeFilters();
|
2015-08-27 06:44:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-08-27 08:45:22 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimManagedViewCollection::updatePropertyFilters()
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < managedViews.size(); i++)
|
|
|
|
{
|
|
|
|
RimManagedViewConfig* managedViewConfig = managedViews[i];
|
|
|
|
if (managedViewConfig->managedView())
|
|
|
|
{
|
|
|
|
if (managedViewConfig->syncPropertyFilters())
|
|
|
|
{
|
|
|
|
RimView* rimView = managedViewConfig->managedView();
|
|
|
|
RimEclipseView* eclipeView = dynamic_cast<RimEclipseView*>(rimView);
|
|
|
|
if (eclipeView)
|
|
|
|
{
|
2015-08-28 01:01:40 -05:00
|
|
|
eclipeView->scheduleGeometryRegen(RANGE_FILTERED);
|
|
|
|
eclipeView->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);
|
|
|
|
|
2015-08-27 08:45:22 -05:00
|
|
|
eclipeView->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
RimGeoMechView* geoView = dynamic_cast<RimGeoMechView*>(rimView);
|
|
|
|
if (geoView)
|
|
|
|
{
|
2015-08-28 01:01:40 -05:00
|
|
|
geoView->scheduleGeometryRegen(PROPERTY_FILTERED);
|
2015-08-27 08:45:22 -05:00
|
|
|
|
|
|
|
geoView->scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
|
|
|
}
|
2015-08-28 01:01:40 -05:00
|
|
|
|
|
|
|
// Notify recursively
|
|
|
|
managedViewConfig->managedView()->managedViewCollection()->updatePropertyFilters();
|
2015-08-27 08:45:22 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-08-28 01:01:40 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimManagedViewCollection::configureOverrides()
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < managedViews.size(); i++)
|
|
|
|
{
|
|
|
|
RimManagedViewConfig* managedViewConfig = managedViews[i];
|
2015-08-28 01:06:35 -05:00
|
|
|
managedViewConfig->configureOverrides();
|
2015-08-28 01:01:40 -05:00
|
|
|
}
|
|
|
|
}
|
2015-08-28 14:05:56 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimManagedViewCollection::allManagedViews(std::vector<RimView*>& views)
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < managedViews.size(); i++)
|
|
|
|
{
|
|
|
|
managedViews[i]->allManagedViews(views);
|
|
|
|
}
|
|
|
|
}
|
2015-08-30 06:30:46 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimManagedViewCollection::applyAllOperations()
|
|
|
|
{
|
|
|
|
RimView* masterView = NULL;
|
|
|
|
firstAnchestorOrThisOfType(masterView);
|
|
|
|
|
|
|
|
configureOverrides();
|
|
|
|
|
|
|
|
updateCellResult();
|
|
|
|
updateTimeStep(masterView->currentTimeStep());
|
|
|
|
updateRangeFilters();
|
|
|
|
updatePropertyFilters();
|
|
|
|
}
|