#4892 Add 3DView context command to remove comparison view

This commit is contained in:
Jacob Støren 2019-10-28 13:39:43 +01:00
parent b729ce7228
commit ff7c586021
6 changed files with 131 additions and 0 deletions

View File

@ -8,6 +8,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicUnLinkViewFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicShowLinkOptionsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDeleteAllLinkedViewsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicSetMasterViewFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRemoveComparison3dViewFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -19,6 +20,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicUnLinkViewFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowLinkOptionsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeleteAllLinkedViewsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicSetMasterViewFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRemoveComparison3dViewFeature.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,89 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicRemoveComparison3dViewFeature.h"
#include "RiaApplication.h"
#include "Rim3dView.h"
#include "RiuViewer.h"
#include "RiuViewerCommands.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicRemoveComparison3dViewFeature, "RicRemoveComparison3dViewFeature" );
class RemoveComparison3dViewImpl
{
public:
bool makeReady()
{
m_activeView = RiaApplication::instance()->activeReservoirView();
if ( m_activeView && m_activeView->viewer()->viewerCommands()->isCurrentPickInComparisonView() )
{
return true;
}
else
{
return false;
}
}
void execute()
{
m_activeView->setComparisonView( nullptr );
m_activeView->scheduleCreateDisplayModelAndRedraw();
}
private:
Rim3dView* m_activeView = nullptr;
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicRemoveComparison3dViewFeature::isCommandEnabled()
{
RemoveComparison3dViewImpl cmdImpl;
return cmdImpl.makeReady();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRemoveComparison3dViewFeature::onActionTriggered( bool isChecked )
{
RemoveComparison3dViewImpl cmdImpl;
if ( cmdImpl.makeReady() )
{
cmdImpl.execute();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRemoveComparison3dViewFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Remove Comparison" );
actionToSetup->setIcon( QIcon( ":/RemoveComparisonView16x16.png" ) );
}

View File

@ -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 RicRemoveComparison3dViewFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

View File

@ -60,6 +60,7 @@
<file>chain.png</file>
<file>UnLinkView16x16.png</file>
<file>LinkView16x16.png</file>
<file>RemoveComparisonView16x16.png</file>
<file>MasterView16x16.png</file>
<file>ControlledView16x16.png</file>
<file>TileWindows24x24.png</file>

View File

@ -518,7 +518,9 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event )
menuBuilder << "RicLinkViewFeature";
menuBuilder << "RicShowLinkOptionsFeature";
menuBuilder << "RicSetMasterViewFeature";
menuBuilder.addSeparator();
menuBuilder << "RicUnLinkViewFeature";
menuBuilder << "RicRemoveComparison3dViewFeature";
}
else if ( int2dView )
{