mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-03 04:00:57 -06:00
#168 Added Perspective/parallel view tool button
This commit is contained in:
parent
4eddcc859a
commit
27830dcbeb
@ -41,6 +41,7 @@ ${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.h
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicWellLogsImportFileFeature.h
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicTogglePerspectiveViewFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicTileWindowsFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicTilePlotWindowsFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicShowPlotWindowFeature.h
|
||||
@ -92,6 +93,7 @@ ${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.cpp
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicTogglePerspectiveViewFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicTileWindowsFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicTilePlotWindowsFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicShowPlotWindowFeature.cpp
|
||||
|
72
ApplicationCode/Commands/RicTogglePerspectiveViewFeature.cpp
Normal file
72
ApplicationCode/Commands/RicTogglePerspectiveViewFeature.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RicTogglePerspectiveViewFeature.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
#include "RimView.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicTogglePerspectiveViewFeature, "RicTogglePerspectiveViewFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicTogglePerspectiveViewFeature::isCommandEnabled()
|
||||
{
|
||||
this->action(); // Retrieve the action to update the looks
|
||||
return RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTogglePerspectiveViewFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
if(RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
|
||||
{
|
||||
bool isPerspective = RiaApplication::instance()->activeReservoirView()->isPerspectiveView();
|
||||
RiaApplication::instance()->activeReservoirView()->isPerspectiveView = !isPerspective;
|
||||
RiaApplication::instance()->activeReservoirView()->viewer()->enableParallelProjection(isPerspective);
|
||||
RiaApplication::instance()->activeReservoirView()->isPerspectiveView.uiCapability()->updateConnectedEditors();
|
||||
this->action(); // Retrieve the action to update the looks
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTogglePerspectiveViewFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
if(RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
|
||||
{
|
||||
if (RiaApplication::instance()->activeReservoirView()->isPerspectiveView())
|
||||
{
|
||||
actionToSetup->setText("Parallel View");
|
||||
actionToSetup->setIcon(QIcon(":/Parallel16x16.png"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
actionToSetup->setText("Perspective View");
|
||||
actionToSetup->setIcon(QIcon(":/Perspective16x16.png"));
|
||||
}
|
39
ApplicationCode/Commands/RicTogglePerspectiveViewFeature.h
Normal file
39
ApplicationCode/Commands/RicTogglePerspectiveViewFeature.h
Normal file
@ -0,0 +1,39 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
// Copyright (C) 2016- 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"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicTogglePerspectiveViewFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
};
|
||||
|
||||
|
BIN
ApplicationCode/Resources/Parallel16x16.png
Normal file
BIN
ApplicationCode/Resources/Parallel16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 190 B |
BIN
ApplicationCode/Resources/Perspective16x16.png
Normal file
BIN
ApplicationCode/Resources/Perspective16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 367 B |
@ -61,6 +61,8 @@
|
||||
<file>SummaryPlots16x16.png</file>
|
||||
<file>SummaryCurve16x16.png</file>
|
||||
<file>SummaryCurveFilter16x16.png</file>
|
||||
<file>Parallel16x16.png</file>
|
||||
<file>Perspective16x16.png</file>
|
||||
|
||||
</qresource>
|
||||
<qresource prefix="/Shader/">
|
||||
|
@ -513,6 +513,7 @@ void RiuMainWindow::createToolBars()
|
||||
// View toolbar
|
||||
m_viewToolBar = addToolBar(tr("View"));
|
||||
m_viewToolBar->setObjectName(m_viewToolBar->windowTitle());
|
||||
m_viewToolBar->addAction(cmdFeatureMgr->action("RicTogglePerspectiveViewFeature"));
|
||||
m_viewToolBar->addAction(m_zoomAll);
|
||||
m_viewToolBar->addAction(m_viewFromNorth);
|
||||
m_viewToolBar->addAction(m_viewFromSouth);
|
||||
@ -721,7 +722,7 @@ void RiuMainWindow::slotRefreshViewActions()
|
||||
|
||||
updateScaleValue();
|
||||
|
||||
caf::CmdFeatureManager::instance()->refreshEnabledState(QStringList() << "RicLinkVisibleViewsFeature" << "RicTileWindowsFeature");
|
||||
caf::CmdFeatureManager::instance()->refreshEnabledState(QStringList() << "RicLinkVisibleViewsFeature" << "RicTileWindowsFeature" << "RicTogglePerspectiveViewFeature");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user