mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Initial commit of ResInsight version 0.4.8
This commit is contained in:
89
ApplicationCode/UserInterface/RICursors.cpp
Normal file
89
ApplicationCode/UserInterface/RICursors.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 "RIStdInclude.h"
|
||||
|
||||
#include "RICursors.h"
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtGui/QBitmap>
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RICursors::RICursors()
|
||||
{
|
||||
m_cursors[FILTER_BOX] = cursorFromFile(":/Cursors/curFilterBox.bmp", 10, 10);
|
||||
m_cursors[NORMAL] = cursorFromFile(":/Cursors/curNormal.bmp", 10, 10);
|
||||
m_cursors[PAN] = cursorFromFile(":/Cursors/curPan.bmp");
|
||||
m_cursors[WALK] = cursorFromFile(":/Cursors/curWalk.bmp");
|
||||
m_cursors[ZOOM] = cursorFromFile(":/Cursors/curZoom.bmp");
|
||||
m_cursors[ROTATE] = cursorFromFile(":/Cursors/curRotate.bmp");
|
||||
|
||||
m_cursors[PICK] = cursorFromFile(":/Cursors/curPick.bmp", 10, 10);
|
||||
m_cursors[PICK_ROTPOINT]= cursorFromFile(":/Cursors/curPickRotPoint.bmp", 10, 10);
|
||||
m_cursors[PICK_GOTO] = cursorFromFile(":/Cursors/curPickGoto.bmp", 10, 10);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QCursor RICursors::get(CursorIndex cursorIdx)
|
||||
{
|
||||
// Create our single instance in a local static variable
|
||||
static RICursors myStaticInstance;
|
||||
|
||||
return myStaticInstance.m_cursors[cursorIdx];
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QCursor RICursors::cursorFromFile(const QString& fileName, int hotspotX, int hotspotY)
|
||||
{
|
||||
QImage image(fileName);
|
||||
if (image.width() == 0 || image.height() == 0)
|
||||
{
|
||||
return QCursor();
|
||||
}
|
||||
|
||||
QRgb maskClr = image.pixel(0, 0);
|
||||
//QImage imgMask = image.createMaskFromColor(maskClr, Qt::MaskInColor);
|
||||
QImage imgMask = image.createHeuristicMask(true);
|
||||
|
||||
QBitmap bmMask = QBitmap::fromImage(imgMask, Qt::ThresholdDither | Qt::AvoidDither);
|
||||
|
||||
QBitmap bitmap = QBitmap::fromImage(image, Qt::ThresholdDither | Qt::AvoidDither);
|
||||
|
||||
return QCursor(bitmap, bmMask, hotspotX, hotspotY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
56
ApplicationCode/UserInterface/RICursors.h
Normal file
56
ApplicationCode/UserInterface/RICursors.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 <QtGui/QCursor>
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// Singleton for getting the cursors
|
||||
//
|
||||
//==================================================================================================
|
||||
class RICursors
|
||||
{
|
||||
public:
|
||||
enum CursorIndex
|
||||
{
|
||||
FILTER_BOX,
|
||||
NORMAL,
|
||||
PAN,
|
||||
WALK,
|
||||
ZOOM,
|
||||
ROTATE,
|
||||
PICK,
|
||||
PICK_GOTO,
|
||||
PICK_ROTPOINT,
|
||||
NUM_CURSORS
|
||||
};
|
||||
|
||||
public:
|
||||
static QCursor get(CursorIndex cursorIdx);
|
||||
|
||||
private:
|
||||
RICursors();
|
||||
static QCursor cursorFromFile(const QString& fileName, int hotspotX = -1, int hotspotY = -1);
|
||||
|
||||
private:
|
||||
QCursor m_cursors[NUM_CURSORS];
|
||||
};
|
||||
1118
ApplicationCode/UserInterface/RIMainWindow.cpp
Normal file
1118
ApplicationCode/UserInterface/RIMainWindow.cpp
Normal file
File diff suppressed because it is too large
Load Diff
211
ApplicationCode/UserInterface/RIMainWindow.h
Normal file
211
ApplicationCode/UserInterface/RIMainWindow.h
Normal file
@@ -0,0 +1,211 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 <QtGui/QMainWindow>
|
||||
#include "qevent.h"
|
||||
#include "cafUiTreeModelPdm.h"
|
||||
#include <QPointer>
|
||||
|
||||
class QTreeView;
|
||||
class QMdiArea;
|
||||
class QFrame;
|
||||
class QMdiSubWindow;
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
|
||||
class RIViewer;
|
||||
class RIResultInfoPanel;
|
||||
class RIProcessMonitor;
|
||||
class RimUiTreeModelPdm;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class UiPropertyCreatorPdm;
|
||||
class UiTreeModelPdm;
|
||||
class PdmObject;
|
||||
class FrameAnimationControl;
|
||||
class AnimationToolBar;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RIMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RIMainWindow();
|
||||
static RIMainWindow* instance();
|
||||
|
||||
void initializeGuiNewProjectLoaded();
|
||||
void cleanupGuiBeforeProjectClose();
|
||||
|
||||
void refreshGuiLightweight();
|
||||
void refreshToolbars();
|
||||
|
||||
void removeViewer( RIViewer* viewer );
|
||||
void addViewer(RIViewer* viewer);
|
||||
void setActiveViewer(RIViewer* subWindow);
|
||||
|
||||
void setResultInfo(const QString& info) const;
|
||||
|
||||
void refreshAnimationActions();
|
||||
|
||||
RimUiTreeModelPdm* uiPdmModel() { return m_treeModelPdm;}
|
||||
|
||||
RIProcessMonitor* processMonitor();
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent* event);
|
||||
|
||||
private:
|
||||
void createActions();
|
||||
void createMenus();
|
||||
void createToolBars();
|
||||
void createDockPanels();
|
||||
void saveWinGeoAndDockToolBarLayout();
|
||||
void loadWinGeoAndDockToolBarLayout();
|
||||
|
||||
bool checkForDocumentModifications();
|
||||
|
||||
void updateMRUList(const QString &fileName, bool remove = false);
|
||||
|
||||
QMdiSubWindow* findMdiSubWindow(RIViewer* viewer);
|
||||
|
||||
private:
|
||||
static RIMainWindow* sm_mainWindowInstance;
|
||||
|
||||
QByteArray m_initialDockAndToolbarLayout; // Initial dock window and toolbar layout, used to reset GUI
|
||||
|
||||
private:
|
||||
// File actions
|
||||
QAction* m_openAction;
|
||||
QAction* m_openProjectAction;
|
||||
QAction* m_openLastUsedProjectAction;
|
||||
QAction* m_mockModelAction;
|
||||
QAction* m_mockResultsModelAction;
|
||||
QAction* m_mockLargeResultsModelAction;
|
||||
QAction* m_saveProjectAction;
|
||||
QAction* m_saveProjectAsAction;
|
||||
QAction* m_closeAction;
|
||||
QAction* m_exitAction;
|
||||
|
||||
// Edit actions
|
||||
QAction* m_editPreferences;
|
||||
|
||||
// View actions
|
||||
QAction* m_viewFromNorth;
|
||||
QAction* m_viewFromSouth;
|
||||
QAction* m_viewFromEast;
|
||||
QAction* m_viewFromWest;
|
||||
QAction* m_viewFromAbove;
|
||||
QAction* m_viewFromBelow;
|
||||
QAction* m_zoomAll;
|
||||
|
||||
// Debug actions
|
||||
QAction* m_debugUseShaders;
|
||||
QAction* m_performanceHud;
|
||||
|
||||
// Help actions
|
||||
QAction* m_aboutAction;
|
||||
|
||||
// Animation
|
||||
caf::AnimationToolBar* m_animationToolBar;
|
||||
|
||||
// Toolbars
|
||||
QToolBar* m_viewToolBar;
|
||||
QToolBar* m_standardToolBar;
|
||||
|
||||
|
||||
QFrame* m_CentralFrame;
|
||||
QMdiArea* m_mdiArea;
|
||||
RIViewer* m_mainViewer;
|
||||
RIResultInfoPanel* m_resultInfoPanel;
|
||||
RIProcessMonitor* m_processMonitor;
|
||||
|
||||
QMenu* m_windowMenu;
|
||||
|
||||
|
||||
// Menu and action slots
|
||||
private slots:
|
||||
|
||||
// File slots
|
||||
void slotOpenFile();
|
||||
void slotOpenProject();
|
||||
void slotOpenLastUsedProject();
|
||||
|
||||
void slotMockModel();
|
||||
void slotMockResultsModel();
|
||||
void slotMockLargeResultsModel();
|
||||
|
||||
void slotSaveProject();
|
||||
void slotSaveProjectAs();
|
||||
void slotCloseProject();
|
||||
|
||||
void slotRefreshFileActions();
|
||||
|
||||
// Edit slots
|
||||
void slotRefreshEditActions();
|
||||
void slotEditPreferences();
|
||||
|
||||
// View slots
|
||||
void slotRefreshViewActions();
|
||||
void slotViewFromNorth();
|
||||
void slotViewFromSouth();
|
||||
void slotViewFromEast();
|
||||
void slotViewFromWest();
|
||||
void slotViewFromAbove();
|
||||
void slotViewFromBelow();
|
||||
void slotZoomAll();
|
||||
|
||||
// Debug slots
|
||||
void slotRefreshDebugActions();
|
||||
void slotUseShaders(bool enable);
|
||||
void slotShowPerformanceInfo(bool enable);
|
||||
|
||||
// Windows slots
|
||||
void slotBuildWindowActions();
|
||||
|
||||
// Help slots
|
||||
void slotAbout();
|
||||
|
||||
void slotSubWindowActivated(QMdiSubWindow* subWindow);
|
||||
void slotCurrentChanged(const QModelIndex & current, const QModelIndex & previous);
|
||||
|
||||
// Animation slots
|
||||
void slotSetCurrentFrame(int frameIndex);
|
||||
void slotFramerateChanged(double frameRate);
|
||||
|
||||
// Pdm System :
|
||||
public:
|
||||
void setPdmRoot(caf::PdmObject* pdmRoot);
|
||||
|
||||
private:
|
||||
QTreeView* m_treeView;
|
||||
caf::UiPropertyCreatorPdm* m_uiManagerPdm;
|
||||
RimUiTreeModelPdm* m_treeModelPdm;
|
||||
caf::PdmObject* m_pdmRoot;
|
||||
|
||||
|
||||
};
|
||||
69
ApplicationCode/UserInterface/RIPreferencesDialog.cpp
Normal file
69
ApplicationCode/UserInterface/RIPreferencesDialog.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 "RIStdInclude.h"
|
||||
#include "RIPreferencesDialog.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "RimUiTreeModelPdm.h"
|
||||
#include "qtgroupboxpropertybrowser.h"
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RIPreferencesDialog::RIPreferencesDialog(QWidget* parent, caf::PdmObject* object)
|
||||
: QDialog(parent)
|
||||
{
|
||||
CVF_ASSERT(object);
|
||||
|
||||
m_pdmObject = object;
|
||||
|
||||
setupUi();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIPreferencesDialog::setupUi()
|
||||
{
|
||||
setWindowTitle("Preferences");
|
||||
|
||||
m_uiManagerPdm = new RimUiPropertyCreatorPdm(this);
|
||||
|
||||
QVBoxLayout* dialogLayout = new QVBoxLayout;
|
||||
setLayout(dialogLayout);
|
||||
|
||||
QtGroupBoxPropertyBrowser* groupPropertyBrowser = new QtGroupBoxPropertyBrowser();
|
||||
m_uiManagerPdm->setPropertyBrowser(groupPropertyBrowser);
|
||||
m_uiManagerPdm->createAndShowPropertiesForObject(m_pdmObject);
|
||||
dialogLayout->addWidget(groupPropertyBrowser);
|
||||
|
||||
|
||||
// Buttons
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
|
||||
dialogLayout->addWidget(buttonBox);
|
||||
|
||||
this->resize(400, 200);
|
||||
}
|
||||
48
ApplicationCode/UserInterface/RIPreferencesDialog.h
Normal file
48
ApplicationCode/UserInterface/RIPreferencesDialog.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 <QDialog>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObject;
|
||||
class UiPropertyCreatorPdm;
|
||||
}
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RIPreferencesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RIPreferencesDialog(QWidget* parent, caf::PdmObject* object);
|
||||
|
||||
private:
|
||||
void setupUi();
|
||||
|
||||
private:
|
||||
caf::PdmObject* m_pdmObject;
|
||||
caf::UiPropertyCreatorPdm* m_uiManagerPdm;
|
||||
};
|
||||
168
ApplicationCode/UserInterface/RIProcessMonitor.cpp
Normal file
168
ApplicationCode/UserInterface/RIProcessMonitor.cpp
Normal file
@@ -0,0 +1,168 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 "RIStdInclude.h"
|
||||
|
||||
#include "RIProcessMonitor.h"
|
||||
#include "cafUiProcess.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RIProcessMonitor::RIProcessMonitor(QDockWidget* pParent)
|
||||
: QWidget(pParent)
|
||||
{
|
||||
m_monitoredProcess = NULL;
|
||||
|
||||
QLabel* pLabel = new QLabel("Status:", this);
|
||||
pLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
|
||||
m_labelStatus = new QLabel(this);
|
||||
|
||||
QHBoxLayout* pTopLayout = new QHBoxLayout;
|
||||
pTopLayout->addWidget(pLabel);
|
||||
pTopLayout->addWidget(m_labelStatus);
|
||||
|
||||
|
||||
m_textEdit = new QPlainTextEdit(this);
|
||||
m_textEdit->setReadOnly(true);
|
||||
m_textEdit->setLineWrapMode(QPlainTextEdit::NoWrap);
|
||||
|
||||
//QFont font("Courier", 8);
|
||||
QFont font("Terminal", 10);
|
||||
m_textEdit->setFont(font);
|
||||
|
||||
QVBoxLayout* pLayout = new QVBoxLayout();
|
||||
pLayout->addLayout(pTopLayout);
|
||||
pLayout->addWidget(m_textEdit);
|
||||
|
||||
setLayout(pLayout);
|
||||
|
||||
setStatusMsg("N/A", caf::PROCESS_STATE_NORMAL);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RIProcessMonitor::~RIProcessMonitor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIProcessMonitor::startMonitorWorkProcess(caf::UiProcess* pProcess)
|
||||
{
|
||||
setStatusMsg("N/A", caf::PROCESS_STATE_NORMAL);
|
||||
m_textEdit->clear();
|
||||
|
||||
if (m_monitoredProcess == pProcess) return;
|
||||
|
||||
m_monitoredProcess = pProcess;
|
||||
if (!m_monitoredProcess) return;
|
||||
|
||||
connect(m_monitoredProcess, SIGNAL(signalStatusMsg(const QString&, int)), SLOT(slotShowProcStatusMsg(const QString&, int)));
|
||||
connect(m_monitoredProcess, SIGNAL(readyReadStandardError()), SLOT(slotProcReadyReadStdErr()));
|
||||
connect(m_monitoredProcess, SIGNAL(readyReadStandardOutput()), SLOT(slotProcReadyReadStdOut()));
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIProcessMonitor::stopMonitorWorkProcess()
|
||||
{
|
||||
m_monitoredProcess = NULL;
|
||||
|
||||
setStatusMsg("N/A", caf::PROCESS_STATE_NORMAL);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIProcessMonitor::setStatusMsg(const QString& sStatusMsg, int iStatusMsgType)
|
||||
{
|
||||
if (!m_labelStatus) return;
|
||||
|
||||
QString sMsg;
|
||||
|
||||
switch (iStatusMsgType)
|
||||
{
|
||||
case caf::PROCESS_STATE_RUNNING: sMsg = "<font color='green'>" + sStatusMsg + "</font>"; break;
|
||||
case caf::PROCESS_STATE_ERROR: sMsg = "<font color='red'>" + sStatusMsg + "</font>"; break;
|
||||
default: sMsg = sStatusMsg;
|
||||
}
|
||||
|
||||
m_labelStatus->setText(sMsg);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIProcessMonitor::addStringToLog(const QString& sTxt)
|
||||
{
|
||||
m_textEdit->moveCursor(QTextCursor::End);
|
||||
m_textEdit->insertPlainText(sTxt);
|
||||
|
||||
m_textEdit->ensureCursorVisible();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIProcessMonitor::slotShowProcStatusMsg(const QString& sMsg, int iStatusMsgType)
|
||||
{
|
||||
setStatusMsg(sMsg, iStatusMsgType);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIProcessMonitor::slotProcReadyReadStdOut()
|
||||
{
|
||||
if (!m_monitoredProcess) return;
|
||||
|
||||
QByteArray dataArray = m_monitoredProcess->readAllStandardOutput();
|
||||
|
||||
dataArray.replace("\r", "");
|
||||
|
||||
addStringToLog(dataArray.data());
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIProcessMonitor::slotProcReadyReadStdErr()
|
||||
{
|
||||
if (!m_monitoredProcess) return;
|
||||
|
||||
QByteArray dataArray = m_monitoredProcess->readAllStandardError();
|
||||
|
||||
dataArray.replace("\r", "");
|
||||
|
||||
addStringToLog(dataArray.data());
|
||||
}
|
||||
|
||||
62
ApplicationCode/UserInterface/RIProcessMonitor.h
Normal file
62
ApplicationCode/UserInterface/RIProcessMonitor.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 <QtGui/QWidget>
|
||||
|
||||
class QDockWidget;
|
||||
class QLabel;
|
||||
class QPlainTextEdit;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class UiProcess;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RIProcessMonitor : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
QLabel* m_labelStatus; // Shows current status string
|
||||
QPlainTextEdit* m_textEdit; // Showing the textual output from the process
|
||||
|
||||
caf::UiProcess* m_monitoredProcess; // Pointer to the process we're monitoring. Needed to fetch text
|
||||
|
||||
public:
|
||||
RIProcessMonitor(QDockWidget* pParent);
|
||||
~RIProcessMonitor();
|
||||
|
||||
void startMonitorWorkProcess(caf::UiProcess* process);
|
||||
void stopMonitorWorkProcess();
|
||||
|
||||
private:
|
||||
void setStatusMsg(const QString& status, int messageType);
|
||||
void addStringToLog(const QString& text);
|
||||
|
||||
private slots:
|
||||
void slotShowProcStatusMsg(const QString& message, int messageType);
|
||||
void slotProcReadyReadStdOut();
|
||||
void slotProcReadyReadStdErr();
|
||||
};
|
||||
|
||||
79
ApplicationCode/UserInterface/RIResultInfoPanel.cpp
Normal file
79
ApplicationCode/UserInterface/RIResultInfoPanel.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 "RIStdInclude.h"
|
||||
#include "RIResultInfoPanel.h"
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
/// \class RIResultInfoPanel
|
||||
/// \ingroup ResInsight
|
||||
///
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RIResultInfoPanel::RIResultInfoPanel(QDockWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
m_textEdit = new QTextEdit(this);
|
||||
m_textEdit->setReadOnly(true);
|
||||
m_textEdit->setLineWrapMode(QTextEdit::NoWrap);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->addWidget(m_textEdit);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIResultInfoPanel::setInfo(const QString& info)
|
||||
{
|
||||
QString tmp(info);
|
||||
|
||||
convertStringToHTML(&tmp);
|
||||
|
||||
m_textEdit->setText(info);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIResultInfoPanel::convertStringToHTML(QString* str)
|
||||
{
|
||||
str->replace("\n", "<br>");
|
||||
str->replace(" ", " ");
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize RIResultInfoPanel::sizeHint () const
|
||||
{
|
||||
// As small as possible fow now
|
||||
return QSize(20, 20);
|
||||
}
|
||||
50
ApplicationCode/UserInterface/RIResultInfoPanel.h
Normal file
50
ApplicationCode/UserInterface/RIResultInfoPanel.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 <QtGui/QWidget>
|
||||
|
||||
class QDockWidget;
|
||||
class QTextEdit;
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// RIResultInfoPanel
|
||||
//
|
||||
//==================================================================================================
|
||||
class RIResultInfoPanel : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RIResultInfoPanel(QDockWidget* parent);
|
||||
|
||||
void setInfo(const QString& info);
|
||||
|
||||
virtual QSize sizeHint () const;
|
||||
|
||||
private:
|
||||
static void convertStringToHTML(QString* str);
|
||||
|
||||
private:
|
||||
QTextEdit* m_textEdit;
|
||||
};
|
||||
|
||||
348
ApplicationCode/UserInterface/RIViewer.cpp
Normal file
348
ApplicationCode/UserInterface/RIViewer.cpp
Normal file
@@ -0,0 +1,348 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 "RIStdInclude.h"
|
||||
|
||||
#include "RIViewer.h"
|
||||
#include "RIApplication.h"
|
||||
#include "RIMainWindow.h"
|
||||
|
||||
#include "cvfqtOpenGLContext.h"
|
||||
#include "cvfqtPerformanceInfoHud.h"
|
||||
#include "cvfCamera.h"
|
||||
#include "cvfRendering.h"
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "RICursors.h"
|
||||
#include "RigReservoir.h"
|
||||
|
||||
#include "cafUtils.h"
|
||||
#include "cafFrameAnimationControl.h"
|
||||
#include "cafNavigationPolicy.h"
|
||||
|
||||
using cvf::ManipulatorTrackball;
|
||||
|
||||
|
||||
const double RI_MIN_NEARPLANE_DISTANCE = 0.1;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
/// \class RIViewer
|
||||
/// \ingroup ResInsight
|
||||
///
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RIViewer::RIViewer(const QGLFormat& format, QWidget* parent)
|
||||
: caf::Viewer(format, parent)
|
||||
{
|
||||
cvf::FixedAtlasFont* font = new cvf::FixedAtlasFont(cvf::FixedAtlasFont::STANDARD);
|
||||
cvf::OverlayAxisCross* axisCross = new cvf::OverlayAxisCross(m_mainCamera.p(), font);
|
||||
axisCross->setAxisLabels("E", "N", "Z");
|
||||
m_mainRendering->addOverlayItem(axisCross, cvf::OverlayItem::BOTTOM_LEFT, cvf::OverlayItem::VERTICAL);
|
||||
|
||||
setReleaseOGLResourcesEachFrame(true);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RIViewer::~RIViewer()
|
||||
{
|
||||
m_reservoirView->showWindow = false;
|
||||
m_reservoirView->cameraPosition = m_mainCamera->viewMatrix();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIViewer::setColorLegend1(cvf::OverlayColorLegend* legend)
|
||||
{
|
||||
if (m_legend1.notNull() && legend == NULL)
|
||||
{
|
||||
m_mainRendering->removeOverlayItem(m_legend1.p());
|
||||
}
|
||||
|
||||
m_legend1 = legend;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIViewer::setColorLegend2(cvf::OverlayColorLegend* legend)
|
||||
{
|
||||
if (m_legend2.notNull() && legend == NULL)
|
||||
{
|
||||
m_mainRendering->removeOverlayItem(m_legend2.p());
|
||||
}
|
||||
|
||||
m_legend2 = legend;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIViewer::setDefaultView()
|
||||
{
|
||||
cvf::BoundingBox bb;
|
||||
|
||||
cvf::Scene* scene = m_renderingSequence->firstRendering()->scene();
|
||||
if (scene)
|
||||
{
|
||||
bb = scene->boundingBox();
|
||||
}
|
||||
|
||||
if (!bb.isValid())
|
||||
{
|
||||
bb.add(cvf::Vec3d(-1, -1, -1));
|
||||
bb.add(cvf::Vec3d( 1, 1, 1));
|
||||
}
|
||||
|
||||
|
||||
if (m_mainCamera->projection() == cvf::Camera::PERSPECTIVE)
|
||||
{
|
||||
m_mainCamera->setProjectionAsPerspective(40.0, RI_MIN_NEARPLANE_DISTANCE, 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bb.isValid())
|
||||
{
|
||||
m_mainCamera->setProjectionAsOrtho(bb.extent().length(), RI_MIN_NEARPLANE_DISTANCE, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
m_mainCamera->fitView(bb, cvf::Vec3d::Y_AXIS, cvf::Vec3d::Z_AXIS);
|
||||
// m_trackball->setRotationPoint(bb.center());
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIViewer::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
m_mouseState.updateFromMouseEvent(event);
|
||||
|
||||
if (!this->canRender()) return;
|
||||
|
||||
// Get the currently set button press action
|
||||
// We get it here since left click performs it, while we let a clean right click cancel it
|
||||
RIApplication* app = RIApplication::instance();
|
||||
|
||||
// Picking
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
handlePickAction(event->x(), event->y());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIViewer::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
// Trap escape key so we can get out of direct button press actions
|
||||
if (event->key() == Qt::Key_Escape)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIViewer::handlePickAction(int winPosX, int winPosY)
|
||||
{
|
||||
RIApplication* app = RIApplication::instance();
|
||||
|
||||
RIMainWindow* mainWnd = RIMainWindow::instance();
|
||||
if (!mainWnd) return;
|
||||
|
||||
QString pickInfo = "No hits";
|
||||
QString resultInfo = "";
|
||||
|
||||
uint faceIndex = cvf::UNDEFINED_UINT;
|
||||
cvf::Vec3d localIntersectionPoint(cvf::Vec3d::ZERO);
|
||||
|
||||
cvf::Part * firstHitPart = NULL;
|
||||
firstHitPart = pickPointAndFace(winPosX, winPosY, &faceIndex, &localIntersectionPoint);
|
||||
if (firstHitPart)
|
||||
{
|
||||
// If a drawable geometry was hit, get info about the picked geometry
|
||||
// and possibly the picked scalar value, if any
|
||||
if (faceIndex != cvf::UNDEFINED_UINT)
|
||||
{
|
||||
size_t gridIndex = firstHitPart->id();
|
||||
|
||||
size_t cellIndex = cvf::UNDEFINED_SIZE_T;
|
||||
if (firstHitPart->sourceInfo())
|
||||
{
|
||||
const cvf::Array<size_t>* cellIndices = dynamic_cast<const cvf::Array<size_t>*>(firstHitPart->sourceInfo());
|
||||
if (cellIndices)
|
||||
{
|
||||
cellIndex = cellIndices->get(faceIndex);
|
||||
|
||||
m_reservoirView->pickInfo(gridIndex, cellIndex, localIntersectionPoint, &pickInfo);
|
||||
|
||||
if (isAnimationActive())
|
||||
{
|
||||
m_reservoirView->appendCellResultInfo(gridIndex, cellIndex, &resultInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mainWnd->statusBar()->showMessage(pickInfo);
|
||||
mainWnd->setResultInfo(resultInfo);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIViewer::slotEndAnimation()
|
||||
{
|
||||
cvf::Rendering* firstRendering = m_renderingSequence->firstRendering();
|
||||
CVF_ASSERT(firstRendering);
|
||||
|
||||
firstRendering->removeOverlayItem(m_legend1.p());
|
||||
firstRendering->removeOverlayItem(m_legend2.p());
|
||||
|
||||
if (m_reservoirView) m_reservoirView->endAnimation();
|
||||
|
||||
caf::Viewer::slotEndAnimation();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIViewer::slotSetCurrentFrame(int frameIndex)
|
||||
{
|
||||
cvf::Rendering* firstRendering = m_renderingSequence->firstRendering();
|
||||
CVF_ASSERT(firstRendering);
|
||||
|
||||
firstRendering->removeOverlayItem(m_legend1.p());
|
||||
firstRendering->removeOverlayItem(m_legend2.p());
|
||||
|
||||
if (m_legend1.notNull())
|
||||
{
|
||||
firstRendering->addOverlayItem(m_legend1.p(), cvf::OverlayItem::BOTTOM_LEFT, cvf::OverlayItem::VERTICAL);
|
||||
}
|
||||
|
||||
if (m_legend2.notNull())
|
||||
{
|
||||
firstRendering->addOverlayItem(m_legend2.p(), cvf::OverlayItem::BOTTOM_LEFT, cvf::OverlayItem::VERTICAL);
|
||||
}
|
||||
|
||||
if (m_reservoirView) m_reservoirView->setCurrentTimeStep(frameIndex);
|
||||
|
||||
caf::Viewer::slotSetCurrentFrame(frameIndex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RIViewer::pointOfInterest()
|
||||
{
|
||||
return m_navigationPolicy->pointOfInterest();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIViewer::setPointOfInterest(cvf::Vec3d poi)
|
||||
{
|
||||
m_navigationPolicy->setPointOfInterest(poi);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIViewer::setOwnerReservoirView(RimReservoirView * owner)
|
||||
{
|
||||
m_reservoirView = owner;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIViewer::setEnableMask(unsigned int mask)
|
||||
{
|
||||
m_mainRendering->setEnableMask(mask);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Perform picking and return the index of the face that was hit, if a drawable geo was hit
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Part* RIViewer::pickPointAndFace(int winPosX, int winPosY, uint* faceHit, cvf::Vec3d* localIntersectionPoint)
|
||||
{
|
||||
CVF_ASSERT(faceHit);
|
||||
|
||||
cvf::HitItemCollection pPoints;
|
||||
bool isSomethingHit = rayPick(winPosX, winPosY, &pPoints);
|
||||
|
||||
if (isSomethingHit)
|
||||
{
|
||||
CVF_ASSERT(pPoints.count() > 0);
|
||||
cvf::HitItem* firstItem = pPoints.firstItem();
|
||||
const cvf::Part* pickedPart = firstItem->part();
|
||||
CVF_ASSERT(pickedPart);
|
||||
|
||||
const cvf::Transform* xf = pickedPart->transform();
|
||||
cvf::Vec3d globalPickedPoint = firstItem->intersectionPoint();
|
||||
|
||||
if(localIntersectionPoint)
|
||||
{
|
||||
if (xf)
|
||||
{
|
||||
*localIntersectionPoint = globalPickedPoint.getTransformedPoint(xf->worldTransform().getInverted());
|
||||
}
|
||||
else
|
||||
{
|
||||
*localIntersectionPoint = globalPickedPoint;
|
||||
}
|
||||
}
|
||||
|
||||
if (faceHit)
|
||||
{
|
||||
|
||||
const cvf::HitDetailDrawableGeo* detail = dynamic_cast<const cvf::HitDetailDrawableGeo*>(firstItem->detail());
|
||||
if (detail)
|
||||
{
|
||||
*faceHit = detail->faceIndex();
|
||||
}
|
||||
}
|
||||
|
||||
return const_cast<cvf::Part*>(pickedPart); // Hack. The const'ness of HitItem will probably change to non-const
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
75
ApplicationCode/UserInterface/RIViewer.h
Normal file
75
ApplicationCode/UserInterface/RIViewer.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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 "cafViewer.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include "cafMouseState.h"
|
||||
|
||||
class RimReservoirView;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class Part;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// RIViewer
|
||||
//
|
||||
//==================================================================================================
|
||||
class RIViewer : public caf::Viewer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RIViewer(const QGLFormat& format, QWidget* parent);
|
||||
~RIViewer();
|
||||
|
||||
void setColorLegend1(cvf::OverlayColorLegend* legend);
|
||||
void setColorLegend2(cvf::OverlayColorLegend* legend);
|
||||
void setDefaultView();
|
||||
cvf::Vec3d pointOfInterest();
|
||||
void setPointOfInterest(cvf::Vec3d poi);
|
||||
void setOwnerReservoirView(RimReservoirView * owner);
|
||||
void setEnableMask(unsigned int mask);
|
||||
|
||||
public slots:
|
||||
virtual void slotSetCurrentFrame(int frameIndex);
|
||||
virtual void slotEndAnimation();
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void mouseReleaseEvent(QMouseEvent* event);
|
||||
|
||||
void handlePickAction(int winPosX, int winPosY);
|
||||
cvf::Part* pickPointAndFace(int winPosX, int winPosY, uint* faceHit, cvf::Vec3d* localIntersectionPoint);
|
||||
|
||||
private:
|
||||
caf::QtMouseState m_mouseState;
|
||||
|
||||
cvf::ref<cvf::OverlayColorLegend> m_legend1;
|
||||
cvf::ref<cvf::OverlayColorLegend> m_legend2;
|
||||
|
||||
caf::PdmPointer<RimReservoirView> m_reservoirView;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user