mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 14:40:26 -05:00
#4892 Add "Compare To ..." command in views
This commit is contained in:
1 parent
a89670bc22
commit
5ea43dda19
7 files changed
+158
-1
No files matched your search
@@ -9,6 +9,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicShowLinkOptionsFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteAllLinkedViewsFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSetMasterViewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRemoveComparison3dViewFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCompareTo3dViewFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -21,6 +22,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicShowLinkOptionsFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicDeleteAllLinkedViewsFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSetMasterViewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicRemoveComparison3dViewFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCompareTo3dViewFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Statoil ASA
|
||||
//
|
||||
// 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 "RicCompareTo3dViewFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimGridView.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicCompareTo3dViewFeature, "RicCompareTo3dViewFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCompareTo3dViewFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCompareTo3dViewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
||||
|
||||
QVariant userData = this->userData();
|
||||
auto view = static_cast<Rim3dView*>(userData.value<void*>());
|
||||
|
||||
if (view && activeView)
|
||||
{
|
||||
activeView->setComparisonView( view );
|
||||
activeView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCompareTo3dViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
QVariant userData = actionToSetup->data();
|
||||
|
||||
auto view = static_cast<Rim3dView*>(userData.value<void*>());
|
||||
if ( view )
|
||||
{
|
||||
actionToSetup->setIcon(view->uiIconProvider().icon() );
|
||||
}
|
||||
else
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/ComparisonView16x16.png"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Statoil ASA
|
||||
//
|
||||
// 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"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicCompareTo3dViewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user