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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-09-07 07:29:46 -05:00
|
|
|
#include "RimViewLinker.h"
|
2015-08-25 05:40:55 -05:00
|
|
|
|
2015-09-01 10:14:22 -05:00
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
|
|
|
#include "RimCase.h"
|
2015-08-25 05:40:55 -05:00
|
|
|
#include "RimEclipseCellColors.h"
|
2015-09-08 03:17:35 -05:00
|
|
|
#include "RimEclipseInputCase.h"
|
|
|
|
#include "RimEclipseResultCase.h"
|
2015-08-25 05:40:55 -05:00
|
|
|
#include "RimEclipseResultDefinition.h"
|
|
|
|
#include "RimEclipseView.h"
|
2015-09-08 03:17:35 -05:00
|
|
|
#include "RimGeoMechCase.h"
|
2015-09-01 10:14:22 -05:00
|
|
|
#include "RimGeoMechCellColors.h"
|
|
|
|
#include "RimGeoMechResultDefinition.h"
|
|
|
|
#include "RimGeoMechView.h"
|
2015-09-11 06:46:37 -05:00
|
|
|
#include "RimViewLink.h"
|
2015-09-01 10:14:22 -05:00
|
|
|
#include "RimProject.h"
|
2015-08-25 05:40:55 -05:00
|
|
|
#include "RimView.h"
|
2015-09-08 03:17:35 -05:00
|
|
|
#include "RimViewLinkerCollection.h"
|
2015-08-25 05:40:55 -05:00
|
|
|
|
|
|
|
#include "RiuViewer.h"
|
|
|
|
|
|
|
|
#include "cvfCamera.h"
|
2015-09-04 04:42:45 -05:00
|
|
|
#include "cafFrameAnimationControl.h"
|
2015-08-25 05:40:55 -05:00
|
|
|
#include "cvfMatrix4.h"
|
2015-09-01 10:14:22 -05:00
|
|
|
#include "cafPdmUiTreeOrdering.h"
|
2015-08-25 05:40:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-11 06:42:06 -05:00
|
|
|
CAF_PDM_SOURCE_INIT(RimViewLinker, "RimViewLinker");
|
2015-08-25 05:40:55 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
RimViewLinker::RimViewLinker(void)
|
2015-08-25 05:40:55 -05:00
|
|
|
{
|
2015-09-07 05:14:50 -05:00
|
|
|
CAF_PDM_InitObject("Linked Views", ":/Reservoir1View.png", "", "");
|
2015-09-01 10:14:22 -05:00
|
|
|
|
2015-09-07 07:54:54 -05:00
|
|
|
CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", "");
|
|
|
|
m_isActive.uiCapability()->setUiHidden(true);
|
|
|
|
|
2015-09-02 06:44:56 -05:00
|
|
|
CAF_PDM_InitField(&m_name, "Name", QString("View Group Name"), "View Group Name", "", "", "");
|
|
|
|
m_name.uiCapability()->setUiHidden(true);
|
2015-09-01 10:14:22 -05:00
|
|
|
|
2015-09-02 06:44:56 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_mainView, "MainView", "Main View", "", "", "");
|
|
|
|
m_mainView.uiCapability()->setUiChildrenHidden(true);
|
|
|
|
m_mainView.uiCapability()->setUiHidden(true);
|
2015-08-25 05:40:55 -05:00
|
|
|
|
2015-09-11 10:19:33 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&viewLinks, "ManagedViews", "Managed Views", "", "", "");
|
|
|
|
viewLinks.uiCapability()->setUiHidden(true);
|
2015-08-25 05:40:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
RimViewLinker::~RimViewLinker(void)
|
2015-08-25 05:40:55 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
void RimViewLinker::updateTimeStep(RimView* sourceView, int timeStep)
|
2015-08-25 05:40:55 -05:00
|
|
|
{
|
2015-09-07 07:54:54 -05:00
|
|
|
if (!isActive()) return;
|
|
|
|
|
2015-09-11 10:19:33 -05:00
|
|
|
RimViewLink* sourceLinkedView = viewLinkFromView(sourceView);
|
2015-09-07 07:29:46 -05:00
|
|
|
if (sourceLinkedView && !sourceLinkedView->syncTimeStep())
|
2015-09-01 10:14:22 -05:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-09-02 10:18:02 -05:00
|
|
|
if (m_mainView && m_mainView->viewer() && sourceView != m_mainView)
|
2015-09-01 10:14:22 -05:00
|
|
|
{
|
2015-09-02 06:44:56 -05:00
|
|
|
m_mainView->viewer()->setCurrentFrame(timeStep);
|
2015-09-04 04:42:45 -05:00
|
|
|
m_mainView->viewer()->animationControl()->setCurrentFrameOnly(timeStep);
|
2015-09-01 10:14:22 -05:00
|
|
|
}
|
|
|
|
|
2015-09-11 10:19:33 -05:00
|
|
|
for (size_t i = 0; i < viewLinks.size(); i++)
|
2015-08-25 05:40:55 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
RimViewLink* managedViewConfig = viewLinks[i];
|
2015-09-01 10:14:22 -05:00
|
|
|
if (managedViewConfig->managedView() && managedViewConfig->managedView() != sourceView)
|
2015-08-25 05:40:55 -05:00
|
|
|
{
|
|
|
|
if (managedViewConfig->syncTimeStep() && managedViewConfig->managedView()->viewer())
|
|
|
|
{
|
2015-09-01 10:14:22 -05:00
|
|
|
managedViewConfig->managedView()->viewer()->setCurrentFrame(timeStep);
|
2015-09-04 04:42:45 -05:00
|
|
|
managedViewConfig->managedView()->viewer()->animationControl()->setCurrentFrameOnly(timeStep);
|
2015-08-25 05:40:55 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
void RimViewLinker::updateCellResult()
|
2015-08-25 05:40:55 -05:00
|
|
|
{
|
2015-09-07 07:54:54 -05:00
|
|
|
if (!isActive()) return;
|
|
|
|
|
2015-09-02 06:44:56 -05:00
|
|
|
RimView* rimView = m_mainView;
|
2015-09-01 10:14:22 -05:00
|
|
|
RimEclipseView* masterEclipseView = dynamic_cast<RimEclipseView*>(rimView);
|
2015-08-27 07:57:04 -05:00
|
|
|
if (masterEclipseView && masterEclipseView->cellResult())
|
2015-08-25 05:40:55 -05:00
|
|
|
{
|
2015-08-27 07:57:04 -05:00
|
|
|
RimEclipseResultDefinition* eclipseCellResultDefinition = masterEclipseView->cellResult();
|
|
|
|
|
2015-09-11 10:19:33 -05:00
|
|
|
for (size_t i = 0; i < viewLinks.size(); i++)
|
2015-08-25 05:40:55 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
RimViewLink* managedViewConfig = viewLinks[i];
|
2015-08-27 07:57:04 -05:00
|
|
|
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-09-01 10:14:22 -05:00
|
|
|
RimGeoMechView* masterGeoView = dynamic_cast<RimGeoMechView*>(rimView);
|
2015-08-27 07:57:04 -05:00
|
|
|
if (masterGeoView && masterGeoView->cellResult())
|
|
|
|
{
|
|
|
|
RimGeoMechResultDefinition* geoMechResultDefinition = masterGeoView->cellResult();
|
|
|
|
|
2015-09-11 10:19:33 -05:00
|
|
|
for (size_t i = 0; i < viewLinks.size(); i++)
|
2015-08-27 07:57:04 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
RimViewLink* managedViewConfig = viewLinks[i];
|
2015-08-27 07:57:04 -05:00
|
|
|
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-27 06:44:27 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
void RimViewLinker::updateRangeFilters()
|
2015-08-27 06:44:27 -05:00
|
|
|
{
|
2015-09-07 07:54:54 -05:00
|
|
|
if (!isActive()) return;
|
|
|
|
|
2015-09-11 10:19:33 -05:00
|
|
|
for (size_t i = 0; i < viewLinks.size(); i++)
|
2015-08-27 06:44:27 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
RimViewLink* managedViewConfig = viewLinks[i];
|
2015-08-27 06:44:27 -05:00
|
|
|
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-27 08:45:22 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
void RimViewLinker::updatePropertyFilters()
|
2015-08-27 08:45:22 -05:00
|
|
|
{
|
2015-09-07 07:54:54 -05:00
|
|
|
if (!isActive()) return;
|
|
|
|
|
2015-09-11 10:19:33 -05:00
|
|
|
for (size_t i = 0; i < viewLinks.size(); i++)
|
2015-08-27 08:45:22 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
RimViewLink* managedViewConfig = viewLinks[i];
|
2015-08-27 08:45:22 -05:00
|
|
|
if (managedViewConfig->managedView())
|
|
|
|
{
|
|
|
|
if (managedViewConfig->syncPropertyFilters())
|
|
|
|
{
|
|
|
|
RimView* rimView = managedViewConfig->managedView();
|
|
|
|
RimEclipseView* eclipeView = dynamic_cast<RimEclipseView*>(rimView);
|
|
|
|
if (eclipeView)
|
|
|
|
{
|
2015-09-01 10:14:22 -05:00
|
|
|
eclipeView->scheduleGeometryRegen(PROPERTY_FILTERED);
|
2015-08-28 01:01:40 -05:00
|
|
|
|
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
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
void RimViewLinker::configureOverrides()
|
2015-08-28 01:01:40 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
for (size_t i = 0; i < viewLinks.size(); i++)
|
2015-08-28 01:01:40 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
RimViewLink* managedViewConfig = viewLinks[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
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
void RimViewLinker::allViewsForCameraSync(RimView* source, std::vector<RimView*>& views)
|
2015-08-28 14:05:56 -05:00
|
|
|
{
|
2015-09-07 07:54:54 -05:00
|
|
|
if (!isActive()) return;
|
|
|
|
|
2015-09-03 06:06:00 -05:00
|
|
|
if (source != m_mainView())
|
|
|
|
{
|
|
|
|
views.push_back(m_mainView());
|
|
|
|
}
|
2015-09-01 10:14:22 -05:00
|
|
|
|
2015-09-11 10:19:33 -05:00
|
|
|
for (size_t i = 0; i < viewLinks.size(); i++)
|
2015-08-28 14:05:56 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
if (viewLinks[i]->syncCamera && viewLinks[i]->managedView() && source != viewLinks[i]->managedView())
|
2015-08-31 05:31:38 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
views.push_back(viewLinks[i]->managedView());
|
2015-08-31 05:31:38 -05:00
|
|
|
}
|
2015-08-28 14:05:56 -05:00
|
|
|
}
|
|
|
|
}
|
2015-08-30 06:30:46 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
void RimViewLinker::applyAllOperations()
|
2015-08-30 06:30:46 -05:00
|
|
|
{
|
|
|
|
configureOverrides();
|
|
|
|
|
|
|
|
updateCellResult();
|
2015-09-02 06:44:56 -05:00
|
|
|
updateTimeStep(NULL, m_mainView->currentTimeStep());
|
2015-08-30 06:30:46 -05:00
|
|
|
updateRangeFilters();
|
|
|
|
updatePropertyFilters();
|
2015-09-03 06:06:00 -05:00
|
|
|
updateScaleZ(m_mainView, m_mainView->scaleZ());
|
2015-08-30 06:30:46 -05:00
|
|
|
}
|
2015-09-01 10:14:22 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
QString RimViewLinker::displayNameForView(RimView* view)
|
2015-09-01 10:14:22 -05:00
|
|
|
{
|
2015-09-02 10:18:02 -05:00
|
|
|
QString displayName = "None";
|
2015-09-01 10:14:22 -05:00
|
|
|
|
2015-09-02 10:18:02 -05:00
|
|
|
if (view)
|
|
|
|
{
|
|
|
|
RimCase* rimCase = NULL;
|
|
|
|
view->firstAnchestorOrThisOfType(rimCase);
|
|
|
|
|
2015-09-11 07:16:13 -05:00
|
|
|
displayName = rimCase->caseUserDescription() + ": " + view->name;
|
2015-09-02 10:18:02 -05:00
|
|
|
}
|
2015-09-01 10:14:22 -05:00
|
|
|
|
|
|
|
return displayName;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
void RimViewLinker::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
2015-09-01 10:14:22 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
for (size_t cIdx = 0; cIdx < viewLinks.size(); ++cIdx)
|
2015-09-01 10:14:22 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
PdmObjectHandle* childObject = viewLinks[cIdx];
|
2015-09-01 10:14:22 -05:00
|
|
|
if (childObject)
|
|
|
|
{
|
|
|
|
uiTreeOrdering.add(childObject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uiTreeOrdering.setForgetRemainingFields(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-11 10:19:33 -05:00
|
|
|
RimViewLink* RimViewLinker::viewLinkFromView(RimView* view)
|
2015-09-01 10:14:22 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
for (size_t i = 0; i < viewLinks.size(); i++)
|
2015-09-01 10:14:22 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
if (viewLinks[i]->managedView() == view) return viewLinks[i];
|
2015-09-01 10:14:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2015-09-02 01:13:17 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
void RimViewLinker::setMainView(RimView* view)
|
2015-09-02 01:13:17 -05:00
|
|
|
{
|
2015-09-02 06:44:56 -05:00
|
|
|
m_mainView = view;
|
|
|
|
|
2015-09-08 03:17:35 -05:00
|
|
|
setNameAndIcon();
|
2015-09-02 01:13:17 -05:00
|
|
|
}
|
2015-09-02 06:44:56 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
RimView* RimViewLinker::mainView()
|
2015-09-02 06:44:56 -05:00
|
|
|
{
|
|
|
|
return m_mainView;
|
|
|
|
}
|
|
|
|
|
2015-09-02 07:22:36 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
void RimViewLinker::allViews(std::vector<RimView*>& views)
|
2015-09-02 07:22:36 -05:00
|
|
|
{
|
|
|
|
views.push_back(m_mainView());
|
|
|
|
|
2015-09-11 10:19:33 -05:00
|
|
|
for (size_t i = 0; i < viewLinks.size(); i++)
|
2015-09-02 07:22:36 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
if (viewLinks[i]->managedView())
|
2015-09-02 07:22:36 -05:00
|
|
|
{
|
2015-09-11 10:19:33 -05:00
|
|
|
views.push_back(viewLinks[i]->managedView());
|
2015-09-02 07:22:36 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-02 10:18:02 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
void RimViewLinker::initAfterRead()
|
2015-09-02 10:18:02 -05:00
|
|
|
{
|
2015-09-08 03:17:35 -05:00
|
|
|
setNameAndIcon();
|
|
|
|
updateUiIcon();
|
2015-09-02 10:18:02 -05:00
|
|
|
}
|
|
|
|
|
2015-09-03 06:06:00 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-09-07 07:29:46 -05:00
|
|
|
void RimViewLinker::updateScaleZ(RimView* source, double scaleZ)
|
2015-09-03 06:06:00 -05:00
|
|
|
{
|
|
|
|
std::vector<RimView*> views;
|
|
|
|
allViewsForCameraSync(source, views);
|
|
|
|
|
|
|
|
// Make sure scale factors are identical
|
|
|
|
for (size_t i = 0; i < views.size(); i++)
|
|
|
|
{
|
|
|
|
views[i]->setScaleZAndUpdate(scaleZ);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-07 07:54:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimViewLinker::isActive()
|
|
|
|
{
|
2015-09-08 03:17:35 -05:00
|
|
|
RimViewLinkerCollection* viewLinkerCollection = NULL;
|
|
|
|
this->firstAnchestorOrThisOfType(viewLinkerCollection);
|
|
|
|
|
|
|
|
if (!viewLinkerCollection->isActive()) return false;
|
|
|
|
|
2015-09-07 07:54:54 -05:00
|
|
|
return m_isActive;
|
|
|
|
}
|
|
|
|
|
2015-09-08 03:17:35 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimViewLinker::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
|
|
|
{
|
|
|
|
updateUiIcon();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Hande icon update locally as PdmUiItem::updateUiIconFromState works only for static icons
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimViewLinker::updateUiIcon()
|
|
|
|
{
|
|
|
|
QPixmap icPixmap;
|
|
|
|
icPixmap = m_originalIcon.pixmap(16, 16, QIcon::Normal);
|
|
|
|
|
|
|
|
if (!m_isActive)
|
|
|
|
{
|
|
|
|
QIcon temp(icPixmap);
|
|
|
|
icPixmap = temp.pixmap(16, 16, QIcon::Disabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon newIcon(icPixmap);
|
|
|
|
this->setUiIcon(newIcon);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimViewLinker::setNameAndIcon()
|
|
|
|
{
|
|
|
|
m_name = displayNameForView(m_mainView);
|
|
|
|
|
|
|
|
QIcon icon;
|
|
|
|
if (m_mainView)
|
|
|
|
{
|
|
|
|
RimCase* rimCase = NULL;
|
|
|
|
m_mainView->firstAnchestorOrThisOfType(rimCase);
|
|
|
|
|
|
|
|
if (dynamic_cast<RimGeoMechCase*>(rimCase))
|
|
|
|
{
|
|
|
|
icon = QIcon(":/GeoMechCase48x48.png");
|
|
|
|
}
|
|
|
|
else if (dynamic_cast<RimEclipseResultCase*>(rimCase))
|
|
|
|
{
|
|
|
|
icon = QIcon(":/Case48x48.png");
|
|
|
|
}
|
|
|
|
else if (dynamic_cast<RimEclipseInputCase*>(rimCase))
|
|
|
|
{
|
|
|
|
icon = QIcon(":/EclipseInput48x48.png");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_originalIcon = icon;
|
|
|
|
}
|
|
|
|
|