2015-09-15 09:28:17 -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 "RicLinkViewFeature.h"
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
|
|
|
#include "RicLinkVisibleViewsFeature.h"
|
|
|
|
|
|
|
|
#include "RimProject.h"
|
2018-01-09 03:11:28 -06:00
|
|
|
#include "Rim3dView.h"
|
2015-09-22 07:23:51 -05:00
|
|
|
#include "RimViewLinkerCollection.h"
|
|
|
|
#include "RimViewLinker.h"
|
2015-09-15 09:28:17 -05:00
|
|
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
|
|
CAF_CMD_SOURCE_INIT(RicLinkViewFeature, "RicLinkViewFeature");
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicLinkViewFeature::isCommandEnabled()
|
|
|
|
{
|
2018-01-09 03:11:28 -06:00
|
|
|
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
|
2015-09-15 09:28:17 -05:00
|
|
|
if (!activeView) return false;
|
|
|
|
|
2016-11-17 10:39:01 -06:00
|
|
|
RimProject* proj = RiaApplication::instance()->project();
|
|
|
|
RimViewLinker* viewLinker = proj->viewLinkerCollection->viewLinker();
|
|
|
|
|
|
|
|
if(!viewLinker) return false;
|
|
|
|
|
2015-09-25 04:01:41 -05:00
|
|
|
RimViewController* viewController = activeView->viewController();
|
2015-09-24 07:29:13 -05:00
|
|
|
|
|
|
|
if(viewController)
|
2015-09-15 09:28:17 -05:00
|
|
|
{
|
2015-09-24 07:29:13 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-09-25 04:01:41 -05:00
|
|
|
if (!activeView->isMasterView())
|
2015-09-22 07:23:51 -05:00
|
|
|
{
|
2015-09-24 07:29:13 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
2015-09-22 07:23:51 -05:00
|
|
|
}
|
2015-09-15 09:28:17 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicLinkViewFeature::onActionTriggered(bool isChecked)
|
|
|
|
{
|
2018-01-15 07:52:22 -06:00
|
|
|
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
2015-09-15 09:28:17 -05:00
|
|
|
if (!activeView) return;
|
|
|
|
|
2018-01-15 07:52:22 -06:00
|
|
|
std::vector<RimGridView*> views;
|
2015-09-15 09:28:17 -05:00
|
|
|
views.push_back(activeView);
|
|
|
|
|
|
|
|
RicLinkVisibleViewsFeature::linkViews(views);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicLinkViewFeature::setupActionLook(QAction* actionToSetup)
|
|
|
|
{
|
|
|
|
actionToSetup->setText("Link View");
|
|
|
|
actionToSetup->setIcon(QIcon(":/chain.png"));
|
|
|
|
}
|
|
|
|
|