(#446) Added link view commands to context menu in 3D view

This commit is contained in:
Magne Sjaastad 2015-09-15 16:28:17 +02:00
parent 0fd5638c6b
commit 708e34045d
10 changed files with 573 additions and 140 deletions

View File

@ -8,12 +8,18 @@ set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicLinkVisibleViewsFeature.h
${CEE_CURRENT_LIST_DIR}RicLinkVisibleViewsFeatureUi.h
${CEE_CURRENT_LIST_DIR}RicShowAllLinkedViewsFeature.h
${CEE_CURRENT_LIST_DIR}RicLinkViewFeature.h
${CEE_CURRENT_LIST_DIR}RicUnLinkViewFeature.h
${CEE_CURRENT_LIST_DIR}RicShowLinkOptionsFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicLinkVisibleViewsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicLinkVisibleViewsFeatureUi.cpp
${CEE_CURRENT_LIST_DIR}RicShowAllLinkedViewsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicLinkViewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicUnLinkViewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicShowLinkOptionsFeature.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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"
#include "RimView.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicLinkViewFeature, "RicLinkViewFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicLinkViewFeature::isCommandEnabled()
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return false;
RimProject* proj = RiaApplication::instance()->project();
if (!proj->findViewLinkerFromView(activeView))
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLinkViewFeature::onActionTriggered(bool isChecked)
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return;
std::vector<RimView*> views;
views.push_back(activeView);
RicLinkVisibleViewsFeature::linkViews(views);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLinkViewFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Link View");
actionToSetup->setIcon(QIcon(":/chain.png"));
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <vector>
//==================================================================================================
///
//==================================================================================================
class RicLinkViewFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook(QAction* actionToSetup);
};

View File

@ -60,11 +60,72 @@ bool RicLinkVisibleViewsFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicLinkVisibleViewsFeature::onActionTriggered(bool isChecked)
{
RimProject* proj = RiaApplication::instance()->project();
std::vector<RimView*> views;
findNotLinkedVisibleViews(views);
linkViews(views);
return;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLinkVisibleViewsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Link Visible Views");
actionToSetup->setIcon(QIcon(":/chain.png"));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLinkVisibleViewsFeature::allLinkedViews(std::vector<RimView*>& views)
{
RimProject* proj = RiaApplication::instance()->project();
for (size_t i = 0; i < proj->viewLinkerCollection()->viewLinkers().size(); i++)
{
RimViewLinker* linkedViews = proj->viewLinkerCollection()->viewLinkers()[i];
linkedViews->allViews(views);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLinkVisibleViewsFeature::findNotLinkedVisibleViews(std::vector<RimView*> &views)
{
RimProject* proj = RiaApplication::instance()->project();
std::vector<RimView*> alreadyLinkedViews;
allLinkedViews(alreadyLinkedViews);
std::vector<RimView*> visibleViews;
proj->allVisibleViews(visibleViews);
for (size_t i = 0; i < visibleViews.size(); i++)
{
bool isLinked = false;
for (size_t j = 0; j < alreadyLinkedViews.size(); j++)
{
if (visibleViews[i] == alreadyLinkedViews[j])
{
isLinked = true;
}
}
if (!isLinked)
{
views.push_back(visibleViews[i]);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLinkVisibleViewsFeature::linkViews(std::vector<RimView*>& views)
{
RimProject* proj = RiaApplication::instance()->project();
RimViewLinker* viewLinker = NULL;
if (proj->viewLinkerCollection->viewLinkers().size() > 0)
@ -139,56 +200,3 @@ void RicLinkVisibleViewsFeature::onActionTriggered(bool isChecked)
projTreeView->treeView()->setExpanded(modIndex, true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLinkVisibleViewsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Link Visible Views");
actionToSetup->setIcon(QIcon(":/chain.png"));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLinkVisibleViewsFeature::allLinkedViews(std::vector<RimView*>& views)
{
RimProject* proj = RiaApplication::instance()->project();
for (size_t i = 0; i < proj->viewLinkerCollection()->viewLinkers().size(); i++)
{
RimViewLinker* linkedViews = proj->viewLinkerCollection()->viewLinkers()[i];
linkedViews->allViews(views);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLinkVisibleViewsFeature::findNotLinkedVisibleViews(std::vector<RimView*> &views)
{
RimProject* proj = RiaApplication::instance()->project();
std::vector<RimView*> alreadyLinkedViews;
allLinkedViews(alreadyLinkedViews);
std::vector<RimView*> visibleViews;
proj->allVisibleViews(visibleViews);
for (size_t i = 0; i < visibleViews.size(); i++)
{
bool isLinked = false;
for (size_t j = 0; j < alreadyLinkedViews.size(); j++)
{
if (visibleViews[i] == alreadyLinkedViews[j])
{
isLinked = true;
}
}
if (!isLinked)
{
views.push_back(visibleViews[i]);
}
}
}

View File

@ -32,6 +32,9 @@ class RicLinkVisibleViewsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static void linkViews(std::vector<RimView*> &views);
protected:
// Overrides
virtual bool isCommandEnabled();

View File

@ -0,0 +1,93 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicShowLinkOptionsFeature.h"
#include "RiaApplication.h"
#include "RimProject.h"
#include "RimView.h"
#include "RimViewLink.h"
#include "RimViewLinker.h"
#include "RiuMainWindow.h"
#include "cafSelectionManager.h"
#include "cafPdmUiTreeView.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicShowLinkOptionsFeature, "RicShowLinkOptionsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicShowLinkOptionsFeature::isCommandEnabled()
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return false;
RimProject* proj = RiaApplication::instance()->project();
if (proj->findViewLinkerFromView(activeView))
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowLinkOptionsFeature::onActionTriggered(bool isChecked)
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return;
RimProject* proj = RiaApplication::instance()->project();
RimViewLinker* viewLinker = proj->findViewLinkerFromView(activeView);
if (viewLinker)
{
if (viewLinker->mainView() == activeView)
{
RiuMainWindow::instance()->projectTreeView()->selectAsCurrentItem(viewLinker);
return;
}
for (size_t i = 0; i < viewLinker->viewLinks.size(); i++)
{
RimViewLink* viewLink = viewLinker->viewLinks[i];
if (viewLink->managedView() == activeView)
{
RiuMainWindow::instance()->projectTreeView()->selectAsCurrentItem(viewLink);
return;
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowLinkOptionsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Show Link Options");
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <vector>
//==================================================================================================
///
//==================================================================================================
class RicShowLinkOptionsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook(QAction* actionToSetup);
};

View File

@ -0,0 +1,96 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicUnLinkViewFeature.h"
#include "RimViewLink.h"
#include "RimView.h"
#include "RimViewLinker.h"
#include "cafSelectionManager.h"
#include <QAction>
#include "RiaApplication.h"
#include "RimProject.h"
#include "cafCmdFeatureManager.h"
CAF_CMD_SOURCE_INIT(RicUnLinkViewFeature, "RicUnLinkViewFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicUnLinkViewFeature::isCommandEnabled()
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return false;
RimProject* proj = RiaApplication::instance()->project();
RimViewLinker* viewLinker = proj->findViewLinkerFromView(activeView);
if (viewLinker)
{
if (viewLinker->mainView() == activeView)
{
return false;
}
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicUnLinkViewFeature::onActionTriggered(bool isChecked)
{
RimView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return;
RimProject* proj = RiaApplication::instance()->project();
RimViewLinker* viewLinker = proj->findViewLinkerFromView(activeView);
if (viewLinker)
{
for (size_t i = 0; i < viewLinker->viewLinks.size(); i++)
{
RimViewLink* viewLink = viewLinker->viewLinks[i];
if (viewLink->managedView() == activeView)
{
caf::SelectionManager::instance()->setSelectedItem(viewLink);
caf::CmdFeature* feature = caf::CmdFeatureManager::instance()->getCommandFeature("RicDeleteItemFeature");
if (feature)
{
feature->action()->trigger();
return;
}
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicUnLinkViewFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Unlink View");
}

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <vector>
//==================================================================================================
///
//==================================================================================================
class RicUnLinkViewFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook(QAction* actionToSetup);
};

View File

@ -18,52 +18,59 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RiuViewerCommands.h"
#include "RiuViewer.h"
#include "RiaApplication.h"
#include "RicEclipsePropertyFilterNewExec.h"
#include "RicGeoMechPropertyFilterNewExec.h"
#include "RicRangeFilterNewExec.h"
#include "RigCaseData.h"
#include "RigFemPartCollection.h"
#include "RigFemPartGrid.h"
#include "RigGeoMechCaseData.h"
#include "RimCellRangeFilter.h"
#include "RimView.h"
#include "RimCellRangeFilterCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimGeoMechView.h"
#include "RimFaultCollection.h"
#include "RimEclipseCellColors.h"
#include "RimEclipsePropertyFilter.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimGeoMechView.h"
#include "RimEclipseView.h"
#include "RimFaultCollection.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h"
#include "RimGeoMechPropertyFilter.h"
#include "RimGeoMechPropertyFilterCollection.h"
#include "RimGeoMechCellColors.h"
#include "RimProject.h"
#include "RimGeoMechView.h"
#include "RimGeoMechView.h"
#include "RimOilField.h"
#include "RimWellPathCollection.h"
#include "RimProject.h"
#include "RimView.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RiuFemResultTextBuilder.h"
#include "RiuMainWindow.h"
#include "RiuResultTextBuilder.h"
#include "RiuViewer.h"
#include "RivFemPartGeometryGenerator.h"
#include "RivFemPickSourceInfo.h"
#include "RivSourceInfo.h"
#include "RivWellPathSourceInfo.h"
#include "RivFemPickSourceInfo.h"
#include "RivFemPartGeometryGenerator.h"
#include "RigCaseData.h"
#include "RiuMainWindow.h"
#include "RiaApplication.h"
#include "RiuResultTextBuilder.h"
#include "RigGeoMechCaseData.h"
#include "RimGeoMechCase.h"
#include "RigFemPartCollection.h"
#include "RigFemPartGrid.h"
#include "cafCmdExecCommandManager.h"
#include "cafCmdFeature.h"
#include "cafCmdFeatureManager.h"
#include "cvfDrawableGeo.h"
#include "cvfPart.h"
#include "cvfHitItemCollection.h"
#include "cvfPart.h"
#include <QMenu>
#include <QMouseEvent>
#include <QStatusBar>
#include "RiuFemResultTextBuilder.h"
#include "RicRangeFilterNewExec.h"
#include "cafCmdExecCommandManager.h"
#include "RicGeoMechPropertyFilterNewExec.h"
#include "RicEclipsePropertyFilterNewExec.h"
//==================================================================================================
//
@ -107,6 +114,8 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
int winPosX = event->x();
int winPosY = event->y();
QMenu menu;
uint faceIndex = cvf::UNDEFINED_UINT;
cvf::Vec3d localIntersectionPoint(cvf::Vec3d::ZERO);
@ -120,77 +129,107 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
extractIntersectionData(hitItems, &localIntersectionPoint, &firstHitPart, &faceIndex, &nncFirstHitPart, NULL);
}
if (!firstHitPart) return;
if (faceIndex == cvf::UNDEFINED_UINT) return;
if (!firstHitPart->sourceInfo()) return;
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstHitPart->sourceInfo());
const RivFemPickSourceInfo* femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>(firstHitPart->sourceInfo());
if (!(rivSourceInfo || femSourceInfo) ) return;
if (rivSourceInfo)
if (firstHitPart && faceIndex != cvf::UNDEFINED_UINT)
{
if (!rivSourceInfo->hasCellFaceMapping()) return;
const RivSourceInfo* rivSourceInfo = dynamic_cast<const RivSourceInfo*>(firstHitPart->sourceInfo());
const RivFemPickSourceInfo* femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>(firstHitPart->sourceInfo());
// Set the data regarding what was hit
m_currentGridIdx = rivSourceInfo->gridIndex();
m_currentCellIndex = rivSourceInfo->m_cellFaceFromTriangleMapper->cellIndex(faceIndex);
m_currentFaceIndex = rivSourceInfo->m_cellFaceFromTriangleMapper->cellFace(faceIndex);
}
else
{
m_currentGridIdx = femSourceInfo->femPartIndex();
m_currentCellIndex = femSourceInfo->triangleToElmMapper()->elementIndex(faceIndex);
}
// IJK -slice commands
QMenu menu;
menu.addAction(QString("I-slice range filter"), this, SLOT(slotRangeFilterI()));
menu.addAction(QString("J-slice range filter"), this, SLOT(slotRangeFilterJ()));
menu.addAction(QString("K-slice range filter"), this, SLOT(slotRangeFilterK()));
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
if (eclipseView)
{
RimEclipseCellColors* cellColors = eclipseView->cellResult().p();
if (cellColors)
if (rivSourceInfo || femSourceInfo)
{
QAction* propertyAction = new QAction(QString("Add property filter"), this);
connect(propertyAction, SIGNAL(triggered()), SLOT(slotAddEclipsePropertyFilter()));
bool isPerCellFaceResult = RimDefines::isPerCellFaceResult(cellColors->resultVariable());
if (isPerCellFaceResult)
if (rivSourceInfo)
{
propertyAction->setEnabled(false);
if (!rivSourceInfo->hasCellFaceMapping()) return;
// Set the data regarding what was hit
m_currentGridIdx = rivSourceInfo->gridIndex();
m_currentCellIndex = rivSourceInfo->m_cellFaceFromTriangleMapper->cellIndex(faceIndex);
m_currentFaceIndex = rivSourceInfo->m_cellFaceFromTriangleMapper->cellFace(faceIndex);
}
else
{
m_currentGridIdx = femSourceInfo->femPartIndex();
m_currentCellIndex = femSourceInfo->triangleToElmMapper()->elementIndex(faceIndex);
}
menu.addAction(propertyAction);
}
// Hide faults command
const RigCaseData* reservoir = eclipseView->eclipseCase()->reservoirData();
const RigFault* fault = reservoir->mainGrid()->findFaultFromCellIndexAndCellFace(m_currentCellIndex, m_currentFaceIndex);
if (fault)
{
menu.addSeparator();
// IJK -slice commands
menu.addAction(QString("I-slice range filter"), this, SLOT(slotRangeFilterI()));
menu.addAction(QString("J-slice range filter"), this, SLOT(slotRangeFilterJ()));
menu.addAction(QString("K-slice range filter"), this, SLOT(slotRangeFilterK()));
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(m_reservoirView.p());
if (eclipseView)
{
RimEclipseCellColors* cellColors = eclipseView->cellResult().p();
if (cellColors)
{
QAction* propertyAction = new QAction(QString("Add property filter"), this);
connect(propertyAction, SIGNAL(triggered()), SLOT(slotAddEclipsePropertyFilter()));
bool isPerCellFaceResult = RimDefines::isPerCellFaceResult(cellColors->resultVariable());
if (isPerCellFaceResult)
{
propertyAction->setEnabled(false);
}
menu.addAction(propertyAction);
}
// Hide faults command
const RigCaseData* reservoir = eclipseView->eclipseCase()->reservoirData();
const RigFault* fault = reservoir->mainGrid()->findFaultFromCellIndexAndCellFace(m_currentCellIndex, m_currentFaceIndex);
if (fault)
{
menu.addSeparator();
QString faultName = fault->name();
menu.addAction(QString("Hide ") + faultName, this, SLOT(slotHideFault()));
}
}
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(m_reservoirView.p());
if (geoMechView)
{
RimGeoMechCellColors* cellColors = geoMechView->cellResult().p();
if (cellColors)
{
menu.addAction(QString("Add property filter"), this, SLOT(slotAddGeoMechPropertyFilter()));
}
}
QString faultName = fault->name();
menu.addAction(QString("Hide ") + faultName, this, SLOT(slotHideFault()));
}
}
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(m_reservoirView.p());
if (geoMechView)
// View Link commands
{
RimGeoMechCellColors* cellColors = geoMechView->cellResult().p();
if (cellColors)
QStringList commandIds;
commandIds << "RicLinkViewFeature";
commandIds << "RicUnLinkViewFeature";
commandIds << "RicShowLinkOptionsFeature";
bool firstLinkAction = true;
caf::CmdFeatureManager* commandManager = caf::CmdFeatureManager::instance();
for (int i = 0; i < commandIds.size(); i++)
{
menu.addAction(QString("Add property filter"), this, SLOT(slotAddGeoMechPropertyFilter()));
caf::CmdFeature* feature = commandManager->getCommandFeature(commandIds[i].toStdString());
if (feature->canFeatureBeExecuted())
{
QAction* act = commandManager->action(commandIds[i]);
CVF_ASSERT(act);
if (firstLinkAction)
{
if (menu.actions().size() > 0)
{
menu.addSeparator();
}
firstLinkAction = false;
}
menu.addAction(act);
}
}
}