mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#395) Added Show All Linked Views as context menu feature of linked views
This commit is contained in:
parent
e3c11f11e9
commit
d80e64d81d
@ -53,6 +53,7 @@ ${CEE_CURRENT_LIST_DIR}RicWellPathsDeleteAllFeature.h
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicLinkVisibleViewsFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicLinkVisibleViewsFeatureUi.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowAllLinkedViewsFeature.h
|
||||
|
||||
|
||||
# General delete of any object in a child array field
|
||||
@ -109,6 +110,7 @@ ${CEE_CURRENT_LIST_DIR}RicWellPathsDeleteAllFeature.cpp
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicLinkVisibleViewsFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicLinkVisibleViewsFeatureUi.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowAllLinkedViewsFeature.cpp
|
||||
|
||||
# General delete of any object in a child array field
|
||||
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp
|
||||
|
78
ApplicationCode/Commands/RicShowAllLinkedViewsFeature.cpp
Normal file
78
ApplicationCode/Commands/RicShowAllLinkedViewsFeature.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicShowAllLinkedViewsFeature.h"
|
||||
|
||||
#include "RimLinkedViews.h"
|
||||
#include "RimManagedViewConfig.h"
|
||||
#include "RimView.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicShowAllLinkedViewsFeature, "RicShowAllLinkedViewsFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowAllLinkedViewsFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowAllLinkedViewsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimLinkedViews*> linkedViews;
|
||||
caf::SelectionManager::instance()->objectsByType(&linkedViews);
|
||||
|
||||
std::vector<RimManagedViewConfig*> managedViews;
|
||||
caf::SelectionManager::instance()->objectsByType(&managedViews);
|
||||
for (size_t i = 0; i < managedViews.size(); i++)
|
||||
{
|
||||
RimLinkedViews* rimLinked = NULL;
|
||||
managedViews[i]->firstAnchestorOrThisOfType(rimLinked);
|
||||
|
||||
linkedViews.push_back(rimLinked);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < linkedViews.size(); i++)
|
||||
{
|
||||
std::vector<RimView*> views;
|
||||
linkedViews[i]->allViews(views);
|
||||
|
||||
for (size_t j = 0; j < views.size(); j++)
|
||||
{
|
||||
views[j]->showWindow.uiCapability()->setValueFromUi(true);
|
||||
views[j]->uiCapability()->updateUiIconFromToggleField();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowAllLinkedViewsFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Open All Linked Views");
|
||||
}
|
||||
|
38
ApplicationCode/Commands/RicShowAllLinkedViewsFeature.h
Normal file
38
ApplicationCode/Commands/RicShowAllLinkedViewsFeature.h
Normal 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 RicShowAllLinkedViewsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook(QAction* actionToSetup);
|
||||
};
|
@ -46,7 +46,7 @@ CAF_PDM_SOURCE_INIT(RimLinkedViews, "RimLinkedViews");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimLinkedViews::RimLinkedViews(void)
|
||||
{
|
||||
CAF_PDM_InitObject("Linked Views", "", "", "");
|
||||
CAF_PDM_InitObject("Linked Views", ":/ReservoirView.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_name, "Name", QString("View Group Name"), "View Group Name", "", "", "");
|
||||
m_name.uiCapability()->setUiHidden(true);
|
||||
@ -77,11 +77,7 @@ void RimLinkedViews::updateTimeStep(RimView* sourceView, int timeStep)
|
||||
return;
|
||||
}
|
||||
|
||||
if (sourceView && sourceView != m_mainView)
|
||||
{
|
||||
m_mainView->viewer()->setCurrentFrame(timeStep);
|
||||
}
|
||||
else
|
||||
if (m_mainView && m_mainView->viewer() && sourceView != m_mainView)
|
||||
{
|
||||
m_mainView->viewer()->setCurrentFrame(timeStep);
|
||||
}
|
||||
@ -296,10 +292,15 @@ QList<caf::PdmOptionItemInfo> RimLinkedViews::calculateValueOptions(const caf::P
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimLinkedViews::displayNameForView(RimView* view)
|
||||
{
|
||||
RimCase* rimCase = NULL;
|
||||
view->firstAnchestorOrThisOfType(rimCase);
|
||||
QString displayName = "None";
|
||||
|
||||
QString displayName = rimCase->caseUserDescription() + " : " + view->name;
|
||||
if (view)
|
||||
{
|
||||
RimCase* rimCase = NULL;
|
||||
view->firstAnchestorOrThisOfType(rimCase);
|
||||
|
||||
displayName = rimCase->caseUserDescription() + " : " + view->name;
|
||||
}
|
||||
|
||||
return displayName;
|
||||
}
|
||||
@ -341,9 +342,7 @@ void RimLinkedViews::setMainView(RimView* view)
|
||||
{
|
||||
m_mainView = view;
|
||||
|
||||
m_name = displayNameForView(view);
|
||||
|
||||
this->uiCapability()->setUiIcon(view->uiCapability()->uiIcon());
|
||||
initAfterRead();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -370,3 +369,11 @@ void RimLinkedViews::allViews(std::vector<RimView*>& views)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimLinkedViews::initAfterRead()
|
||||
{
|
||||
m_name = displayNameForView(m_mainView);
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ protected:
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_name; }
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "");
|
||||
virtual void initAfterRead();
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimView*> m_mainView;
|
||||
|
@ -42,7 +42,7 @@ CAF_PDM_SOURCE_INIT(RimManagedViewConfig, "RimManagedViewConfig");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimManagedViewConfig::RimManagedViewConfig(void)
|
||||
{
|
||||
CAF_PDM_InitObject("View Config", ":/chain.png", "", "");
|
||||
CAF_PDM_InitObject("View Config", ":/ReservoirView.png", "", "");
|
||||
|
||||
QString defaultName = "View Config : Empty view";
|
||||
CAF_PDM_InitField(&name, "Name", defaultName, "Managed View Name", "", "", "");
|
||||
@ -249,6 +249,9 @@ void RimManagedViewConfig::configureOverrides()
|
||||
this->firstAnchestorOrThisOfType(linkedViews);
|
||||
|
||||
RimView* masterView = linkedViews->mainView();
|
||||
CVF_ASSERT(masterView);
|
||||
|
||||
if (!masterView) return;
|
||||
|
||||
if (m_managedView)
|
||||
{
|
||||
@ -307,6 +310,8 @@ void RimManagedViewConfig::updateViewChanged()
|
||||
CVF_ASSERT(linkedViews);
|
||||
|
||||
RimView* mainView = linkedViews->mainView();
|
||||
CVF_ASSERT(mainView);
|
||||
|
||||
RimEclipseView* eclipseMasterView = dynamic_cast<RimEclipseView*>(mainView);
|
||||
RimGeoMechView* geoMasterView = dynamic_cast<RimGeoMechView*>(mainView);
|
||||
|
||||
@ -366,7 +371,5 @@ RimView* RimManagedViewConfig::managedView()
|
||||
void RimManagedViewConfig::setManagedView(RimView* view)
|
||||
{
|
||||
m_managedView = view;
|
||||
|
||||
this->uiCapability()->setUiIcon(view->uiCapability()->uiIcon());
|
||||
}
|
||||
|
||||
|
@ -752,10 +752,14 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
|
||||
}
|
||||
else if (dynamic_cast<RimManagedViewConfig*>(uiItem))
|
||||
{
|
||||
commandIds << "RicShowAllLinkedViewsFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicDeleteItemFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimLinkedViews*>(uiItem))
|
||||
{
|
||||
commandIds << "RicShowAllLinkedViewsFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicDeleteItemFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogPlotCollection*>(uiItem))
|
||||
|
Loading…
Reference in New Issue
Block a user