Whitespace

This commit is contained in:
Magne Sjaastad
2019-03-26 16:21:28 +01:00
parent 507973688e
commit 9f7be1489d

View File

@@ -26,12 +26,12 @@
#include "RiaRegressionTest.h"
#include "RiaRegressionTestRunner.h"
#include "RimEclipseContourMapView.h"
#include "Rim2dIntersectionView.h"
#include "Rim3dView.h"
#include "RimCellEdgeColors.h"
#include "RimCommandObject.h"
#include "RimEclipseCase.h"
#include "RimEclipseContourMapView.h"
#include "RimEclipseFaultColors.h"
#include "RimEclipsePropertyFilter.h"
#include "RimEclipseResultDefinition.h"
@@ -89,17 +89,16 @@
#include <QLayout>
#include <QMdiSubWindow>
#include <QMenuBar>
#include <QToolButton>
#include <QSpinBox>
#include <QStatusBar>
#include <QTimer>
#include <QToolBar>
#include <QToolButton>
#include <QTreeView>
#include <QUndoStack>
#include <algorithm>
//==================================================================================================
///
/// \class RiuMainWindow
@@ -112,19 +111,19 @@
///
//--------------------------------------------------------------------------------------------------
RiuMainWindow::RiuMainWindow()
: m_pdmRoot(nullptr),
m_relPermPlotPanel(nullptr),
m_pvtPlotPanel(nullptr),
m_mohrsCirclePlot(nullptr),
m_windowMenu(nullptr),
m_blockSlotSubWindowActivated(false),
m_holoLensToolBar(nullptr)
: m_pdmRoot(nullptr)
, m_relPermPlotPanel(nullptr)
, m_pvtPlotPanel(nullptr)
, m_mohrsCirclePlot(nullptr)
, m_windowMenu(nullptr)
, m_blockSlotSubWindowActivated(false)
, m_holoLensToolBar(nullptr)
{
m_mdiArea = new QMdiArea;
connect(m_mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), SLOT(slotSubWindowActivated(QMdiSubWindow*)));
connect(m_mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), SLOT(slotSubWindowActivated(QMdiSubWindow*)));
setCentralWidget(m_mdiArea);
//m_mainViewer = createViewer();
// m_mainViewer = createViewer();
createActions();
createMenus();
@@ -137,11 +136,11 @@ RiuMainWindow::RiuMainWindow()
// Enabling the line below will activate the undo stack
// When enableUndoCommandSystem is set false, all commands are executed and deleted immediately
//caf::CmdExecCommandManager::instance()->enableUndoCommandSystem(true);
// caf::CmdExecCommandManager::instance()->enableUndoCommandSystem(true);
m_memoryCriticalWarning = new QLabel("");
m_memoryUsedButton = new QToolButton(nullptr);
m_memoryTotalStatus = new QLabel("");
m_memoryUsedButton = new QToolButton(nullptr);
m_memoryTotalStatus = new QLabel("");
m_memoryUsedButton->setDefaultAction(caf::CmdFeatureManager::instance()->action("RicShowMemoryCleanupDialogFeature"));
@@ -149,8 +148,6 @@ RiuMainWindow::RiuMainWindow()
statusBar()->addPermanentWidget(m_memoryUsedButton);
statusBar()->addPermanentWidget(m_memoryTotalStatus);
updateMemoryUsage();
m_memoryRefreshTimer = new QTimer(this);
@@ -158,7 +155,6 @@ RiuMainWindow::RiuMainWindow()
m_memoryRefreshTimer->start(1000);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -240,7 +236,8 @@ void RiuMainWindow::cleanupGuiCaseClose()
}
m_processMonitor->startMonitorWorkProcess(nullptr);
RicEditSummaryPlotFeature* editSumCurves = dynamic_cast<RicEditSummaryPlotFeature*>(caf::CmdFeatureManager::instance()->getCommandFeature("RicEditSummaryPlotFeature"));
RicEditSummaryPlotFeature* editSumCurves = dynamic_cast<RicEditSummaryPlotFeature*>(
caf::CmdFeatureManager::instance()->getCommandFeature("RicEditSummaryPlotFeature"));
if (editSumCurves)
{
editSumCurves->closeDialogAndResetTargetPlot();
@@ -271,7 +268,7 @@ void RiuMainWindow::closeEvent(QCloseEvent* event)
if (app->isMainPlotWindowVisible())
{
event->ignore(); // Make Qt think we don't do anything, otherwise it closes the window.
this->hide(); // Instead we just hide it.
this->hide(); // Instead we just hide it.
return;
}
@@ -292,50 +289,50 @@ void RiuMainWindow::closeEvent(QCloseEvent* event)
void RiuMainWindow::createActions()
{
// File actions
m_mockModelAction = new QAction("&Mock Model", this);
m_mockResultsModelAction = new QAction("Mock Model With &Results", this);
m_mockModelAction = new QAction("&Mock Model", this);
m_mockResultsModelAction = new QAction("Mock Model With &Results", this);
m_mockLargeResultsModelAction = new QAction("Large Mock Model", this);
m_mockModelCustomizedAction = new QAction("Customized Mock Model", this);
m_mockInputModelAction = new QAction("Input Mock Model", this);
m_mockModelCustomizedAction = new QAction("Customized Mock Model", this);
m_mockInputModelAction = new QAction("Input Mock Model", this);
m_snapshotAllViewsToFile = new QAction(QIcon(":/SnapShotSaveViews.png"), "Snapshot All Views To File", this);
m_snapshotAllViewsToFile = new QAction(QIcon(":/SnapShotSaveViews.png"), "Snapshot All Views To File", this);
m_createCommandObject = new QAction("Create Command Object", this);
m_showRegressionTestDialog = new QAction("Regression Test Dialog", this);
m_createCommandObject = new QAction("Create Command Object", this);
m_showRegressionTestDialog = new QAction("Regression Test Dialog", this);
m_executePaintEventPerformanceTest = new QAction("&Paint Event Performance Test", this);
connect(m_mockModelAction, SIGNAL(triggered()), SLOT(slotMockModel()));
connect(m_mockResultsModelAction, SIGNAL(triggered()), SLOT(slotMockResultsModel()));
connect(m_mockLargeResultsModelAction, SIGNAL(triggered()), SLOT(slotMockLargeResultsModel()));
connect(m_mockModelCustomizedAction, SIGNAL(triggered()), SLOT(slotMockModelCustomized()));
connect(m_mockInputModelAction, SIGNAL(triggered()), SLOT(slotInputMockModel()));
connect(m_mockModelAction, SIGNAL(triggered()), SLOT(slotMockModel()));
connect(m_mockResultsModelAction, SIGNAL(triggered()), SLOT(slotMockResultsModel()));
connect(m_mockLargeResultsModelAction, SIGNAL(triggered()), SLOT(slotMockLargeResultsModel()));
connect(m_mockModelCustomizedAction, SIGNAL(triggered()), SLOT(slotMockModelCustomized()));
connect(m_mockInputModelAction, SIGNAL(triggered()), SLOT(slotInputMockModel()));
connect(m_snapshotAllViewsToFile, SIGNAL(triggered()), SLOT(slotSnapshotAllViewsToFile()));
connect(m_snapshotAllViewsToFile, SIGNAL(triggered()), SLOT(slotSnapshotAllViewsToFile()));
connect(m_createCommandObject, SIGNAL(triggered()), SLOT(slotCreateCommandObject()));
connect(m_createCommandObject, SIGNAL(triggered()), SLOT(slotCreateCommandObject()));
connect(m_showRegressionTestDialog, SIGNAL(triggered()), SLOT(slotShowRegressionTestDialog()));
connect(m_executePaintEventPerformanceTest, SIGNAL(triggered()), SLOT(slotExecutePaintEventPerformanceTest()));
// View actions
m_viewFromNorth = new QAction(QIcon(":/SouthViewArrow.png"), "Look South", this);
m_viewFromNorth = new QAction(QIcon(":/SouthViewArrow.png"), "Look South", this);
m_viewFromNorth->setToolTip("Look South");
m_viewFromSouth = new QAction(QIcon(":/NorthViewArrow.png"),"Look North", this);
m_viewFromSouth = new QAction(QIcon(":/NorthViewArrow.png"), "Look North", this);
m_viewFromSouth->setToolTip("Look North");
m_viewFromEast = new QAction(QIcon(":/WestViewArrow.png"),"Look West", this);
m_viewFromEast = new QAction(QIcon(":/WestViewArrow.png"), "Look West", this);
m_viewFromEast->setToolTip("Look West");
m_viewFromWest = new QAction(QIcon(":/EastViewArrow.png"),"Look East", this);
m_viewFromWest = new QAction(QIcon(":/EastViewArrow.png"), "Look East", this);
m_viewFromWest->setToolTip("Look East");
m_viewFromAbove = new QAction(QIcon(":/DownViewArrow.png"),"Look Down", this);
m_viewFromAbove = new QAction(QIcon(":/DownViewArrow.png"), "Look Down", this);
m_viewFromAbove->setToolTip("Look Down");
m_viewFromBelow = new QAction(QIcon(":/UpViewArrow.png"),"Look Up", this);
m_viewFromBelow = new QAction(QIcon(":/UpViewArrow.png"), "Look Up", this);
m_viewFromBelow->setToolTip("Look Up");
connect(m_viewFromNorth, SIGNAL(triggered()), SLOT(slotViewFromNorth()));
connect(m_viewFromSouth, SIGNAL(triggered()), SLOT(slotViewFromSouth()));
connect(m_viewFromEast, SIGNAL(triggered()), SLOT(slotViewFromEast()));
connect(m_viewFromWest, SIGNAL(triggered()), SLOT(slotViewFromWest()));
connect(m_viewFromAbove, SIGNAL(triggered()), SLOT(slotViewFromAbove()));
connect(m_viewFromBelow, SIGNAL(triggered()), SLOT(slotViewFromBelow()));
connect(m_viewFromNorth, SIGNAL(triggered()), SLOT(slotViewFromNorth()));
connect(m_viewFromSouth, SIGNAL(triggered()), SLOT(slotViewFromSouth()));
connect(m_viewFromEast, SIGNAL(triggered()), SLOT(slotViewFromEast()));
connect(m_viewFromWest, SIGNAL(triggered()), SLOT(slotViewFromWest()));
connect(m_viewFromAbove, SIGNAL(triggered()), SLOT(slotViewFromAbove()));
connect(m_viewFromBelow, SIGNAL(triggered()), SLOT(slotViewFromBelow()));
// Debug actions
m_newPropertyView = new QAction("New Project and Property View", this);
@@ -344,41 +341,40 @@ void RiuMainWindow::createActions()
// Draw style actions
m_dsActionGroup = new QActionGroup(this);
m_drawStyleLinesAction = new QAction(QIcon(":/draw_style_lines_24x24.png"), "&Mesh Only", this);
//connect(m_drawStyleLinesAction, SIGNAL(triggered()), SLOT(slotDrawStyleLines()));
m_drawStyleLinesAction = new QAction(QIcon(":/draw_style_lines_24x24.png"), "&Mesh Only", this);
// connect(m_drawStyleLinesAction, SIGNAL(triggered()), SLOT(slotDrawStyleLines()));
m_dsActionGroup->addAction(m_drawStyleLinesAction);
m_drawStyleLinesSolidAction = new QAction(QIcon(":/draw_style_meshlines_24x24.png"), "Mesh And Surfaces", this);
//connect(m_drawStyleLinesSolidAction, SIGNAL(triggered()), SLOT(slotDrawStyleLinesSolid()));
m_dsActionGroup->addAction(m_drawStyleLinesSolidAction);
m_drawStyleLinesSolidAction = new QAction(QIcon(":/draw_style_meshlines_24x24.png"), "Mesh And Surfaces", this);
// connect(m_drawStyleLinesSolidAction, SIGNAL(triggered()), SLOT(slotDrawStyleLinesSolid()));
m_dsActionGroup->addAction(m_drawStyleLinesSolidAction);
m_drawStyleFaultLinesSolidAction = new QAction(QIcon(":/draw_style_surface_w_fault_mesh_24x24.png"), "Fault Mesh And Surfaces", this);
m_dsActionGroup->addAction(m_drawStyleFaultLinesSolidAction);
m_drawStyleFaultLinesSolidAction =
new QAction(QIcon(":/draw_style_surface_w_fault_mesh_24x24.png"), "Fault Mesh And Surfaces", this);
m_dsActionGroup->addAction(m_drawStyleFaultLinesSolidAction);
m_drawStyleSurfOnlyAction = new QAction(QIcon(":/draw_style_surface_24x24.png"), "&Surface Only", this);
//connect(m_drawStyleSurfOnlyAction, SIGNAL(triggered()), SLOT(slotDrawStyleSurfOnly()));
m_drawStyleSurfOnlyAction = new QAction(QIcon(":/draw_style_surface_24x24.png"), "&Surface Only", this);
// connect(m_drawStyleSurfOnlyAction, SIGNAL(triggered()), SLOT(slotDrawStyleSurfOnly()));
m_dsActionGroup->addAction(m_drawStyleSurfOnlyAction);
connect(m_dsActionGroup, SIGNAL(triggered(QAction*)), SLOT(slotDrawStyleChanged(QAction*)));
m_disableLightingAction = new QAction(QIcon(":/disable_lighting_24x24.png"), "&Disable Results Lighting", this);
m_disableLightingAction->setCheckable(true);
connect(m_disableLightingAction, SIGNAL(toggled(bool)), SLOT(slotDisableLightingAction(bool)));
connect(m_disableLightingAction, SIGNAL(toggled(bool)), SLOT(slotDisableLightingAction(bool)));
m_drawStyleHideGridCellsAction = new QAction( QIcon(":/draw_style_faults_24x24.png"), "&Hide Grid Cells", this);
m_drawStyleHideGridCellsAction = new QAction(QIcon(":/draw_style_faults_24x24.png"), "&Hide Grid Cells", this);
m_drawStyleHideGridCellsAction->setCheckable(true);
connect(m_drawStyleHideGridCellsAction, SIGNAL(toggled(bool)), SLOT(slotToggleHideGridCellsAction(bool)));
connect(m_drawStyleHideGridCellsAction, SIGNAL(toggled(bool)), SLOT(slotToggleHideGridCellsAction(bool)));
m_toggleFaultsLabelAction = new QAction( QIcon(":/draw_style_faults_label_24x24.png"), "&Show Fault Labels", this);
m_toggleFaultsLabelAction = new QAction(QIcon(":/draw_style_faults_label_24x24.png"), "&Show Fault Labels", this);
m_toggleFaultsLabelAction->setCheckable(true);
connect(m_toggleFaultsLabelAction, SIGNAL(toggled(bool)), SLOT(slotToggleFaultLabelsAction(bool)));
connect(m_toggleFaultsLabelAction, SIGNAL(toggled(bool)), SLOT(slotToggleFaultLabelsAction(bool)));
m_showWellCellsAction = new QAction(QIcon(":/draw_style_WellCellsToRangeFilter_24x24.png"), "&Show Well Cells", this);
m_showWellCellsAction->setCheckable(true);
m_showWellCellsAction->setToolTip("Show Well Cells");
connect(m_showWellCellsAction, SIGNAL(toggled(bool)), SLOT(slotShowWellCellsAction(bool)));
connect(m_showWellCellsAction, SIGNAL(toggled(bool)), SLOT(slotShowWellCellsAction(bool)));
}
//--------------------------------------------------------------------------------------------------
@@ -416,13 +412,13 @@ void RiuMainWindow::createMenus()
importSummaryMenu->addAction(cmdFeatureMgr->action("RicImportSummaryGroupFeature"));
importSummaryMenu->addAction(cmdFeatureMgr->action("RicImportEnsembleFeature"));
#ifdef USE_ODB_API
#ifdef USE_ODB_API
importMenu->addSeparator();
QMenu* importGeoMechMenu = importMenu->addMenu(QIcon(":/GeoMechCase48x48.png"), "Geo Mechanical Cases");
importGeoMechMenu->addAction(cmdFeatureMgr->action("RicImportGeoMechCaseFeature"));
importGeoMechMenu->addAction(cmdFeatureMgr->action("RicImportGeoMechCaseTimeStepFilterFeature"));
importGeoMechMenu->addAction(cmdFeatureMgr->action("RicImportElementPropertyFeature"));
#endif
#endif
importMenu->addSeparator();
QMenu* importWellMenu = importMenu->addMenu(QIcon(":/Well.png"), "Well Data");
@@ -474,7 +470,6 @@ void RiuMainWindow::createMenus()
connect(editMenu, SIGNAL(aboutToShow()), SLOT(slotRefreshEditActions()));
// View menu
QMenu* viewMenu = menuBar()->addMenu("&View");
viewMenu->addAction(cmdFeatureMgr->action("RicViewZoomAllFeature"));
@@ -518,7 +513,6 @@ void RiuMainWindow::createMenus()
helpMenu->addAction(cmdFeatureMgr->action("RicHelpOpenUsersGuideFeature"));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -573,7 +567,6 @@ void RiuMainWindow::createToolBars()
toolbar->hide();
}
// View toolbar
{
QToolBar* toolbar = addToolBar(tr("View"));
@@ -627,7 +620,6 @@ void RiuMainWindow::createToolBars()
toolbar->addAction(measureAction);
auto polyMeasureAction = cmdFeatureMgr->action("RicTogglePolyMeasurementModeFeature");
toolbar->addAction(polyMeasureAction);
}
RiaApplication* app = RiaApplication::instance();
@@ -705,12 +697,14 @@ void RiuMainWindow::createDockPanels()
connect(m_projectTreeView, SIGNAL(selectionChanged()), this, SLOT(selectedObjectsChanged()));
m_projectTreeView->treeView()->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_projectTreeView->treeView(), SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(customMenuRequested(const QPoint&)));
connect(m_projectTreeView->treeView(),
SIGNAL(customContextMenuRequested(const QPoint&)),
SLOT(customMenuRequested(const QPoint&)));
}
QDockWidget* resultPlotDock = nullptr;
QDockWidget* resultPlotDock = nullptr;
QDockWidget* relPermPlotDock = nullptr;
QDockWidget* pvtPlotDock = nullptr;
QDockWidget* pvtPlotDock = nullptr;
#ifdef USE_ODB_API
QDockWidget* mohrsCirclePlotDock = nullptr;
#endif
@@ -845,8 +839,6 @@ void RiuMainWindow::refreshViewActions()
//
//==================================================================================================
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -867,25 +859,23 @@ void RiuMainWindow::slotRefreshFileActions()
cmdFeatureMgr->refreshStates(commandIdList);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotRefreshEditActions()
{
// RiaApplication* app = RiaApplication::instance();
// RISceneManager* proj = app->project();
// RiaApplication* app = RiaApplication::instance();
// RISceneManager* proj = app->project();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotRefreshViewActions()
{
RimGridView* gridView = RiaApplication::instance()->activeGridView();
RimEclipseContourMapView* view2d = dynamic_cast<RimEclipseContourMapView*>(gridView);
bool enabled = gridView != nullptr && view2d == nullptr;
RimGridView* gridView = RiaApplication::instance()->activeGridView();
RimEclipseContourMapView* view2d = dynamic_cast<RimEclipseContourMapView*>(gridView);
bool enabled = gridView != nullptr && view2d == nullptr;
m_viewFromNorth->setEnabled(enabled);
m_viewFromSouth->setEnabled(enabled);
m_viewFromEast->setEnabled(enabled);
@@ -920,7 +910,7 @@ void RiuMainWindow::slotRefreshViewActions()
void RiuMainWindow::refreshAnimationActions()
{
caf::FrameAnimationControl* animationControl = nullptr;
Rim3dView * activeView = RiaApplication::instance()->activeReservoirView();
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
if (activeView && activeView->viewer())
{
@@ -934,20 +924,18 @@ void RiuMainWindow::refreshAnimationActions()
int currentTimeStepIndex = 0;
bool enableAnimControls = false;
if (activeView &&
activeView->viewer() &&
activeView->viewer()->frameCount())
if (activeView && activeView->viewer() && activeView->viewer()->frameCount())
{
enableAnimControls = true;
if ( activeView->isTimeStepDependentDataVisible() )
if (activeView->isTimeStepDependentDataVisible())
{
timeStepStrings = activeView->ownerCase()->timeStepStrings();
}
else
{
RimEclipseView * activeRiv = dynamic_cast<RimEclipseView*>(activeView);
if ( activeRiv && activeRiv->currentGridCellResults() )
RimEclipseView* activeRiv = dynamic_cast<RimEclipseView*>(activeView);
if (activeRiv && activeRiv->currentGridCellResults())
{
timeStepStrings.push_back(tr("Static Property"));
}
@@ -989,7 +977,6 @@ void RiuMainWindow::slotMockResultsModel()
app->createResultsMockModel();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1023,7 +1010,7 @@ void RiuMainWindow::slotInputMockModel()
QMdiSubWindow* RiuMainWindow::findMdiSubWindow(QWidget* viewer)
{
QList<QMdiSubWindow*> subws = m_mdiArea->subWindowList();
int i;
int i;
for (i = 0; i < subws.size(); ++i)
{
if (subws[i]->widget() == viewer)
@@ -1053,8 +1040,6 @@ RimViewWindow* RiuMainWindow::findViewWindowFromSubWindow(QMdiSubWindow* subWind
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1124,13 +1109,13 @@ void RiuMainWindow::addViewer(QWidget* viewer, const RimMdiWindowGeometry& windo
subWin->setAttribute(Qt::WA_DeleteOnClose); // Make sure the contained widget is destroyed when the MDI window is closed
subWin->setWidget(viewer);
QSize subWindowSize;
QSize subWindowSize;
QPoint subWindowPos(-1, -1);
bool initialStateMaximized = false;
bool initialStateMaximized = false;
if (windowsGeometry.isValid())
{
subWindowPos = QPoint(windowsGeometry.x, windowsGeometry.y);
subWindowPos = QPoint(windowsGeometry.x, windowsGeometry.y);
subWindowSize = QSize(windowsGeometry.width, windowsGeometry.height);
}
else
@@ -1199,9 +1184,9 @@ void RiuMainWindow::setPdmRoot(caf::PdmObject* pdmRoot)
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotViewFromNorth()
{
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
{
RiaApplication::instance()->activeReservoirView()->viewer()->setView(cvf::Vec3d(0,-1,0), cvf::Vec3d(0,0,1));
RiaApplication::instance()->activeReservoirView()->viewer()->setView(cvf::Vec3d(0, -1, 0), cvf::Vec3d(0, 0, 1));
}
}
@@ -1210,9 +1195,9 @@ void RiuMainWindow::slotViewFromNorth()
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotViewFromSouth()
{
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
{
RiaApplication::instance()->activeReservoirView()->viewer()->setView(cvf::Vec3d(0,1,0), cvf::Vec3d(0,0,1));
RiaApplication::instance()->activeReservoirView()->viewer()->setView(cvf::Vec3d(0, 1, 0), cvf::Vec3d(0, 0, 1));
}
}
@@ -1221,9 +1206,9 @@ void RiuMainWindow::slotViewFromSouth()
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotViewFromEast()
{
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
{
RiaApplication::instance()->activeReservoirView()->viewer()->setView(cvf::Vec3d(-1,0,0), cvf::Vec3d(0,0,1));
RiaApplication::instance()->activeReservoirView()->viewer()->setView(cvf::Vec3d(-1, 0, 0), cvf::Vec3d(0, 0, 1));
}
}
@@ -1232,9 +1217,9 @@ void RiuMainWindow::slotViewFromEast()
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotViewFromWest()
{
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
{
RiaApplication::instance()->activeReservoirView()->viewer()->setView(cvf::Vec3d(1,0,0), cvf::Vec3d(0,0,1));
RiaApplication::instance()->activeReservoirView()->viewer()->setView(cvf::Vec3d(1, 0, 0), cvf::Vec3d(0, 0, 1));
}
}
@@ -1243,9 +1228,9 @@ void RiuMainWindow::slotViewFromWest()
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotViewFromAbove()
{
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
{
RiaApplication::instance()->activeReservoirView()->viewer()->setView(cvf::Vec3d(0,0,-1), cvf::Vec3d(0,1,0));
RiaApplication::instance()->activeReservoirView()->viewer()->setView(cvf::Vec3d(0, 0, -1), cvf::Vec3d(0, 1, 0));
}
}
@@ -1254,9 +1239,9 @@ void RiuMainWindow::slotViewFromAbove()
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotViewFromBelow()
{
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
{
RiaApplication::instance()->activeReservoirView()->viewer()->setView(cvf::Vec3d(0,0,1), cvf::Vec3d(0,1,0));
RiaApplication::instance()->activeReservoirView()->viewer()->setView(cvf::Vec3d(0, 0, 1), cvf::Vec3d(0, 1, 0));
}
}
@@ -1268,7 +1253,7 @@ void RiuMainWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
if (!subWindow) return;
if (m_blockSlotSubWindowActivated) return;
RimProject * proj = RiaApplication::instance()->project();
RimProject* proj = RiaApplication::instance()->project();
if (!proj) return;
// Find the activated 3D view
@@ -1290,10 +1275,7 @@ void RiuMainWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
{
Rim3dView* riv = views[viewIdx];
if (riv &&
riv->viewer() &&
riv->viewer()->layoutWidget() &&
riv->viewer()->layoutWidget()->parent() == subWindow)
if (riv && riv->viewer() && riv->viewer()->layoutWidget() && riv->viewer()->layoutWidget()->parent() == subWindow)
{
activatedView = riv;
break;
@@ -1315,10 +1297,9 @@ void RiuMainWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
// Try to select the same entry in the new View, as was selected in the previous
QModelIndex previousViewModelIndex = m_projectTreeView->findModelIndex(previousActiveReservoirView);
QModelIndex currentSelectionIndex = m_projectTreeView->treeView()->selectionModel()->currentIndex();
QModelIndex currentSelectionIndex = m_projectTreeView->treeView()->selectionModel()->currentIndex();
if (currentSelectionIndex != newViewModelIndex &&
currentSelectionIndex.isValid())
if (currentSelectionIndex != newViewModelIndex && currentSelectionIndex.isValid())
{
QVector<QModelIndex> route; // Contains all model indices from current selection up to previous view
@@ -1339,7 +1320,8 @@ void RiuMainWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
QModelIndex tmp = route[i];
if (newSelectionIndex.isValid())
{
newSelectionIndex = m_projectTreeView->treeView()->model()->index(tmp.row(), tmp.column(), newSelectionIndex);
newSelectionIndex =
m_projectTreeView->treeView()->model()->index(tmp.row(), tmp.column(), newSelectionIndex);
}
}
@@ -1356,7 +1338,6 @@ void RiuMainWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
{
m_projectTreeView->treeView()->setExpanded(newViewModelIndex, true);
}
}
slotRefreshViewActions();
@@ -1365,18 +1346,17 @@ void RiuMainWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::setActiveViewer(QWidget* viewer)
{
m_blockSlotSubWindowActivated = true;
m_blockSlotSubWindowActivated = true;
QMdiSubWindow * swin = findMdiSubWindow(viewer);
if (swin) m_mdiArea->setActiveSubWindow(swin);
QMdiSubWindow* swin = findMdiSubWindow(viewer);
if (swin) m_mdiArea->setActiveSubWindow(swin);
m_blockSlotSubWindowActivated = false;
m_blockSlotSubWindowActivated = false;
}
//--------------------------------------------------------------------------------------------------
@@ -1394,7 +1374,7 @@ void appendToggleActionForDockingWidget(QMenu* menu, QWidget* parent, const QStr
{
if (menu)
{
auto dwt = RiuDockWidgetTools::instance();
auto dwt = RiuDockWidgetTools::instance();
QAction* action = dwt->toggleActionForWidget(parent, dockWidgetName);
if (action)
{
@@ -1514,13 +1494,13 @@ void RiuMainWindow::selectedObjectsChanged()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotNewObjectPropertyView()
{
QDockWidget* dockWidget = new QDockWidget(QString("Additional Project Tree (%1)").arg(additionalProjectViews.size() + 1), this);
QDockWidget* dockWidget =
new QDockWidget(QString("Additional Project Tree (%1)").arg(additionalProjectViews.size() + 1), this);
dockWidget->setObjectName("dockWidget");
dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
@@ -1581,7 +1561,6 @@ void RiuMainWindow::slotDrawStyleChanged(QAction* activatedAction)
{
RiaApplication::instance()->activeReservoirView()->setFaultMeshSurfDrawstyle();
}
}
//--------------------------------------------------------------------------------------------------
@@ -1595,7 +1574,6 @@ void RiuMainWindow::slotToggleHideGridCellsAction(bool hideGridCells)
if (rigv) rigv->showGridCells(!hideGridCells);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1625,14 +1603,13 @@ void RiuMainWindow::slotToggleFaultLabelsAction(bool showLabels)
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::refreshDrawStyleActions()
{
RimGridView* gridView = RiaApplication::instance()->activeGridView();
RimEclipseContourMapView* view2d = dynamic_cast<RimEclipseContourMapView*>(gridView);
bool is2dMap = view2d != nullptr;
bool is3dGridView = gridView != nullptr && !is2dMap;
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
bool is3dView = view != nullptr && !is2dMap;
RimGridView* gridView = RiaApplication::instance()->activeGridView();
RimEclipseContourMapView* view2d = dynamic_cast<RimEclipseContourMapView*>(gridView);
bool is2dMap = view2d != nullptr;
bool is3dGridView = gridView != nullptr && !is2dMap;
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
bool is3dView = view != nullptr && !is2dMap;
m_drawStyleLinesAction->setEnabled(is3dView);
m_drawStyleLinesSolidAction->setEnabled(is3dView);
@@ -1669,7 +1646,7 @@ void RiuMainWindow::refreshDrawStyleActions()
if (!eclView)
{
Rim2dIntersectionView * intView = dynamic_cast<Rim2dIntersectionView*>(view);
Rim2dIntersectionView* intView = dynamic_cast<Rim2dIntersectionView*>(view);
if (intView)
{
intView->intersection()->firstAncestorOrThisOfType(eclView);
@@ -1678,16 +1655,14 @@ void RiuMainWindow::refreshDrawStyleActions()
m_toggleFaultsLabelAction->setEnabled(eclView != nullptr);
if (eclView )
if (eclView)
{
m_toggleFaultsLabelAction->blockSignals(true);
m_toggleFaultsLabelAction->setChecked(eclView->faultCollection()->showFaultLabel());
m_toggleFaultsLabelAction->blockSignals(false);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1717,7 +1692,8 @@ void RiuMainWindow::restoreTreeViewState()
QString currentIndexString = RiaApplication::instance()->project()->mainWindowCurrentModelIndexPath;
if (!currentIndexString.isEmpty())
{
QModelIndex mi = caf::QTreeViewStateSerializer::getModelIndexFromString(m_projectTreeView->treeView()->model(), currentIndexString);
QModelIndex mi = caf::QTreeViewStateSerializer::getModelIndexFromString(m_projectTreeView->treeView()->model(),
currentIndexString);
m_projectTreeView->treeView()->setCurrentIndex(mi);
}
}
@@ -1726,7 +1702,7 @@ void RiuMainWindow::restoreTreeViewState()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::showDockPanel(const QString &dockPanelName)
void RiuMainWindow::showDockPanel(const QString& dockPanelName)
{
QList<QDockWidget*> dockWidgets = findChildren<QDockWidget*>();
@@ -1748,28 +1724,28 @@ void RiuMainWindow::showDockPanel(const QString &dockPanelName)
void RiuMainWindow::updateUiFieldsFromActiveResult(caf::PdmObjectHandle* objectToUpdate)
{
RimEclipseResultDefinition* resultDefinition = nullptr;
resultDefinition = dynamic_cast<RimEclipseResultDefinition*>(objectToUpdate);
resultDefinition = dynamic_cast<RimEclipseResultDefinition*>(objectToUpdate);
if (resultDefinition)
{
resultDefinition->updateUiFieldsFromActiveResult();
}
RimEclipsePropertyFilter* eclPropFilter = nullptr;
eclPropFilter = dynamic_cast<RimEclipsePropertyFilter*>(objectToUpdate);
eclPropFilter = dynamic_cast<RimEclipsePropertyFilter*>(objectToUpdate);
if (eclPropFilter)
{
eclPropFilter->updateUiFieldsFromActiveResult();
}
RimEclipseFaultColors* eclFaultColors = nullptr;
eclFaultColors = dynamic_cast<RimEclipseFaultColors*>(objectToUpdate);
eclFaultColors = dynamic_cast<RimEclipseFaultColors*>(objectToUpdate);
if (eclFaultColors)
{
eclFaultColors->updateUiFieldsFromActiveResult();
}
RimCellEdgeColors* cellEdgeColors = nullptr;
cellEdgeColors = dynamic_cast<RimCellEdgeColors*>(objectToUpdate);
cellEdgeColors = dynamic_cast<RimCellEdgeColors*>(objectToUpdate);
if (cellEdgeColors)
{
cellEdgeColors->updateUiFieldsFromActiveResult();
@@ -1781,10 +1757,10 @@ void RiuMainWindow::updateUiFieldsFromActiveResult(caf::PdmObjectHandle* objectT
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::updateMemoryUsage()
{
uint64_t currentUsage = caf::MemoryInspector::getApplicationPhysicalMemoryUsageMiB();
uint64_t totalPhysicalMemory = caf::MemoryInspector::getTotalPhysicalMemoryMiB();
uint64_t totalVirtualMemory = caf::MemoryInspector::getTotalVirtualMemoryMiB();
uint64_t availVirtualMemory = caf::MemoryInspector::getAvailableVirtualMemoryMiB();
uint64_t currentUsage = caf::MemoryInspector::getApplicationPhysicalMemoryUsageMiB();
uint64_t totalPhysicalMemory = caf::MemoryInspector::getTotalPhysicalMemoryMiB();
uint64_t totalVirtualMemory = caf::MemoryInspector::getTotalVirtualMemoryMiB();
uint64_t availVirtualMemory = caf::MemoryInspector::getAvailableVirtualMemoryMiB();
QColor okColor(0, 150, 0);
QColor warningColor(200, 0, 0);
@@ -1809,7 +1785,8 @@ void RiuMainWindow::updateMemoryUsage()
if (availVirtualFraction < caf::MemoryInspector::getRemainingMemoryCriticalThresholdFraction())
{
m_memoryCriticalWarning->setText(QString("Available System Memory Critically Low!"));
m_memoryCriticalWarning->setStyleSheet(QString("QLabel {color: %1; padding: 0px 5px 0px 0px;}").arg(criticalColor.name()));
m_memoryCriticalWarning->setStyleSheet(
QString("QLabel {color: %1; padding: 0px 5px 0px 0px;}").arg(criticalColor.name()));
}
else
{
@@ -1855,8 +1832,8 @@ void RiuMainWindow::slotScaleChanged(int scaleValue)
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::updateScaleValue()
{
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
bool isRegularReservoirView = view && dynamic_cast<RimEclipseContourMapView*>(view) == nullptr;
Rim3dView* view = RiaApplication::instance()->activeReservoirView();
bool isRegularReservoirView = view && dynamic_cast<RimEclipseContourMapView*>(view) == nullptr;
if (isRegularReservoirView)
{
m_scaleFactor->setEnabled(true);
@@ -1940,8 +1917,7 @@ void RiuMainWindow::slotShowRegressionTestDialog()
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotExecutePaintEventPerformanceTest()
{
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
if (RiaApplication::instance()->activeReservoirView() && RiaApplication::instance()->activeReservoirView()->viewer())
{
size_t redrawCount = 50;
@@ -1955,9 +1931,12 @@ void RiuMainWindow::slotExecutePaintEventPerformanceTest()
double totalTimeMS = timer.time() * 1000.0;
double msPerFrame = totalTimeMS / redrawCount;
double msPerFrame = totalTimeMS / redrawCount;
QString resultInfo = QString("Total time '%1 ms' for %2 number of redraws, frame time '%3 ms'").arg(totalTimeMS).arg(redrawCount).arg(msPerFrame);
QString resultInfo = QString("Total time '%1 ms' for %2 number of redraws, frame time '%3 ms'")
.arg(totalTimeMS)
.arg(redrawCount)
.arg(msPerFrame);
setResultInfo(resultInfo);
}
}
@@ -2002,8 +1981,8 @@ void RiuMainWindow::customMenuRequested(const QPoint& pos)
// Qt doc: QAbstractScrollArea and its subclasses that map the context menu event to coordinates of the viewport().
// Since we might get this signal from different treeViews, we need to map the position accordingly.
QObject* senderObj = this->sender();
QTreeView* treeView = dynamic_cast<QTreeView*>(senderObj);
QObject* senderObj = this->sender();
QTreeView* treeView = dynamic_cast<QTreeView*>(senderObj);
if (treeView)
{
QPoint globalPos = treeView->viewport()->mapToGlobal(pos);
@@ -2041,9 +2020,9 @@ void RiuMainWindow::tileWindows()
}
// Get the active view linker if there is one
RimProject * proj = RiaApplication::instance()->project();
RimProject* proj = RiaApplication::instance()->project();
RimViewLinkerCollection* viewLinkerCollection = proj->viewLinkerCollection();
RimViewLinker* viewLinker = nullptr;
RimViewLinker* viewLinker = nullptr;
if (viewLinkerCollection && viewLinkerCollection->isActive())
{
viewLinker = viewLinkerCollection->viewLinker();
@@ -2051,12 +2030,11 @@ void RiuMainWindow::tileWindows()
// Perform stable sort of list so we first sort by window position but retain activation order
// for windows with the same position. Needs to be sorted in decreasing order for the workaround below.
windowList.sort([this, viewLinker](QMdiSubWindow* lhs, QMdiSubWindow* rhs)
{
windowList.sort([this, viewLinker](QMdiSubWindow* lhs, QMdiSubWindow* rhs) {
RimViewWindow* lhsViewWindow = findViewWindowFromSubWindow(lhs);
RimViewWindow* rhsViewWindow = findViewWindowFromSubWindow(rhs);
RimGridView* lhsGridView = dynamic_cast<RimGridView*>(lhsViewWindow);
RimGridView* rhsGridView = dynamic_cast<RimGridView*>(rhsViewWindow);
RimGridView* lhsGridView = dynamic_cast<RimGridView*>(lhsViewWindow);
RimGridView* rhsGridView = dynamic_cast<RimGridView*>(rhsViewWindow);
if (viewLinker)
{
@@ -2077,7 +2055,7 @@ void RiuMainWindow::tileWindows()
// Force activation order so they end up in the order of the loop.
m_mdiArea->setActivationOrder(QMdiArea::ActivationHistoryOrder);
QMdiSubWindow *a = m_mdiArea->activeSubWindow();
QMdiSubWindow* a = m_mdiArea->activeSubWindow();
for (QMdiSubWindow* subWindow : windowList)
{
m_mdiArea->setActiveSubWindow(subWindow);
@@ -2096,4 +2074,3 @@ bool RiuMainWindow::isAnyMdiSubWindowVisible()
{
return m_mdiArea->subWindowList().size() > 0;
}