mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-11 16:06:04 -06:00
#4892 Add "Compare To ..." command in views
This commit is contained in:
parent
a89670bc22
commit
5ea43dda19
@ -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;
|
||||
};
|
||||
|
||||
|
BIN
ApplicationCode/Resources/ComparisonView16x16.png
Normal file
BIN
ApplicationCode/Resources/ComparisonView16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 202 B |
@ -60,6 +60,7 @@
|
||||
<file>chain.png</file>
|
||||
<file>UnLinkView16x16.png</file>
|
||||
<file>LinkView16x16.png</file>
|
||||
<file>ComparisonView16x16.png</file>
|
||||
<file>RemoveComparisonView16x16.png</file>
|
||||
<file>MasterView16x16.png</file>
|
||||
<file>ControlledView16x16.png</file>
|
||||
|
@ -40,11 +40,13 @@
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigVirtualPerforationTransmissibilities.h"
|
||||
|
||||
#include "RiaOptionItemFactory.h"
|
||||
#include "Rim2dIntersectionView.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimContextCommandBuilder.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
#include "RimEclipseFaultColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEllipseFractureTemplate.h"
|
||||
@ -53,11 +55,13 @@
|
||||
#include "RimFracture.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechCellColors.h"
|
||||
#include "RimGeoMechContourMapView.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimIntersectionBox.h"
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimStimPlanFractureTemplate.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
@ -148,6 +152,41 @@ void RiuViewerCommands::setOwnerView( Rim3dView* owner )
|
||||
m_reservoirView = owner;
|
||||
}
|
||||
|
||||
void RiuViewerCommands::addCompareToViewMenu( caf::CmdFeatureMenuBuilder* menuBuilder )
|
||||
{
|
||||
RimGridView* mainGridView = dynamic_cast<RimGridView*>( m_reservoirView.p() );
|
||||
if ( mainGridView && !mainGridView->activeComparisonView() )
|
||||
{
|
||||
std::vector<Rim3dView*> validComparisonViews;
|
||||
|
||||
std::vector<Rim3dView*> views;
|
||||
RiaApplication::instance()->project()->allViews( views );
|
||||
for ( auto view : views )
|
||||
{
|
||||
if ( !dynamic_cast<RimGridView*>( view ) ) continue;
|
||||
if ( dynamic_cast<RimEclipseContourMapView*>( view ) ) continue;
|
||||
if ( dynamic_cast<RimGeoMechContourMapView*>( view ) ) continue;
|
||||
|
||||
if ( view != mainGridView )
|
||||
{
|
||||
validComparisonViews.push_back( view );
|
||||
}
|
||||
}
|
||||
|
||||
if ( validComparisonViews.size() )
|
||||
{
|
||||
menuBuilder->subMenuStart( "Compare To ...", QIcon( ":/ComparisonView16x16.png" ) );
|
||||
for ( auto view : validComparisonViews )
|
||||
{
|
||||
menuBuilder->addCmdFeatureWithUserData( "RicCompareTo3dViewFeature",
|
||||
view->autoName(),
|
||||
QVariant::fromValue( static_cast<void*>( view ) ) );
|
||||
}
|
||||
menuBuilder->subMenuEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -518,6 +557,7 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event )
|
||||
menuBuilder << "RicLinkViewFeature";
|
||||
menuBuilder << "RicShowLinkOptionsFeature";
|
||||
menuBuilder << "RicSetMasterViewFeature";
|
||||
addCompareToViewMenu( &menuBuilder );
|
||||
menuBuilder.addSeparator();
|
||||
menuBuilder << "RicUnLinkViewFeature";
|
||||
menuBuilder << "RicRemoveComparison3dViewFeature";
|
||||
|
@ -41,7 +41,8 @@ class QMouseEvent;
|
||||
namespace caf
|
||||
{
|
||||
class PdmObject;
|
||||
}
|
||||
class CmdFeatureMenuBuilder;
|
||||
} // namespace caf
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@ -89,6 +90,8 @@ private:
|
||||
|
||||
bool handleOverlayItemPicking( int winPosX, int winPosY );
|
||||
|
||||
void addCompareToViewMenu( caf::CmdFeatureMenuBuilder* menuBuilder );
|
||||
|
||||
static void addDefaultPickEventHandler( RicDefaultPickEventHandler* pickEventHandler );
|
||||
static void removeDefaultPickEventHandler( RicDefaultPickEventHandler* pickEventHandler );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user