Commit d9e9e6fa authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[ADD #335] preliminary functions that change the view to the data. These are not

nice or guaranteed to work yet.
parent 84a9c400
......@@ -126,12 +126,12 @@ void WMainWindow::setupGUI()
// NOTE: the shortcuts for these view presets should be chosen carefully. Most keysequences have another meaning in the most applications
// so the user may get confused. It is also not a good idea to take letters as they might be used by OpenSceneGraph widget ( like "S" for
// statistics ).
viewMenu->addAction( "Left", this, SLOT( openNotImplementedDialog() ), QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_L ) );
viewMenu->addAction( "Right", this, SLOT( openNotImplementedDialog() ), QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_R ) );
viewMenu->addAction( "Superior", this, SLOT( openNotImplementedDialog() ), QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_S ) );
viewMenu->addAction( "Inferior", this, SLOT( openNotImplementedDialog() ), QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_I ) );
viewMenu->addAction( "Anterior", this, SLOT( openNotImplementedDialog() ), QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_A ) );
viewMenu->addAction( "Posterior", this, SLOT( openNotImplementedDialog() ), QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_P ) );
viewMenu->addAction( "Left", this, SLOT( setPresetViewLeft() ), QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_L ) );
viewMenu->addAction( "Right", this, SLOT( setPresetViewRight() ), QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_R ) );
viewMenu->addAction( "Superior", this, SLOT( setPresetViewSuperior() ), QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_S ) );
viewMenu->addAction( "Inferior", this, SLOT( setPresetViewInferior() ), QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_I ) );
viewMenu->addAction( "Anterior", this, SLOT( setPresetViewAnterior() ), QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_A ) );
viewMenu->addAction( "Posterior", this, SLOT( setPresetViewPosterior() ), QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_P ) );
QMenu* helpMenu = m_menuBar->addMenu( "Help" );
helpMenu->addAction( m_iconManager.getIcon( "help" ), "About OpenWalnut", this, SLOT( openAboutDialog() ),
......@@ -620,6 +620,76 @@ void WMainWindow::openAboutDialog()
"Thank you for using OpenWalnut." );
}
void WMainWindow::setPresetViewLeft()
{
boost::shared_ptr< WGEViewer > viewer;
viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "main" );
osg::ref_ptr< WGEGroupNode > currentScene;
currentScene = viewer->getScene();
osg::Matrix rm;
osg::Matrix tm;
tm.makeTranslate( osg::Vec3( -79.0, -99.0, -79.0 ) );
rm.makeRotate( 90.0 * 3.141 / 180, 0.0, 0.0, 1.0 );
tm *= rm;
viewer->reset();
currentScene->setMatrix( tm );
}
void WMainWindow::setPresetViewRight()
{
boost::shared_ptr< WGEViewer > viewer;
viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "main" );
osg::ref_ptr< WGEGroupNode > currentScene;
currentScene = viewer->getScene();
osg::Matrix rm;
rm.makeRotate( 90.0 * ( 3.141 / 180 ), 0.0, 0.0, -1.0 );
currentScene->setMatrix( rm );
}
void WMainWindow::setPresetViewSuperior()
{
boost::shared_ptr< WGEViewer > viewer;
viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "main" );
osg::ref_ptr< WGEGroupNode > currentScene;
currentScene = viewer->getScene();
osg::Matrix rm;
rm.makeRotate( 90.0 * ( 3.141 / 180 ), 1.0, 0.0, 0.0 );
currentScene->setMatrix( rm );
}
void WMainWindow::setPresetViewInferior()
{
boost::shared_ptr< WGEViewer > viewer;
viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "main" );
osg::ref_ptr< WGEGroupNode > currentScene;
currentScene = viewer->getScene();
osg::Matrix rm;
rm.makeRotate( 90.0 * ( 3.141 / 180 ), -1.0, 0.0, 0.0 );
currentScene->setMatrix( rm );
}
void WMainWindow::setPresetViewAnterior()
{
boost::shared_ptr< WGEViewer > viewer;
viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "main" );
osg::ref_ptr< WGEGroupNode > currentScene;
currentScene = viewer->getScene();
osg::Matrix rm;
rm.makeRotate( 3.141, 0.0, 0.0, 1.0 );
currentScene->setMatrix( rm );
}
void WMainWindow::setPresetViewPosterior()
{
boost::shared_ptr< WGEViewer > viewer;
viewer = WKernel::getRunningKernel()->getGraphicsEngine()->getViewerByName( "main" );
osg::ref_ptr< WGEGroupNode > currentScene;
currentScene = viewer->getScene();
osg::Matrix rm;
// rm.makeRotate( 90.0 * ( 3.141 / 180 ), 0.0, 0.0, 0.0 );
currentScene->setMatrix( rm );
}
void WMainWindow::openNotImplementedDialog()
{
QMessageBox::information( this, "Not yet implemented!",
......
......@@ -169,6 +169,36 @@ public slots:
*/
void openAboutDialog();
/**
* Sets the left preset view of the main viewer.
*/
void setPresetViewLeft();
/**
* Sets the right preset view of the main viewer.
*/
void setPresetViewRight();
/**
* Sets the superior preset view of the main viewer.
*/
void setPresetViewSuperior();
/**
* Sets the inferior preset view of the main viewer.
*/
void setPresetViewInferior();
/**
* Sets the anterior preset view of the main viewer.
*/
void setPresetViewAnterior();
/**
* Sets the posterior preset view of the main viewer.
*/
void setPresetViewPosterior();
/**
* Gets called when a menu entry that has no functionality yet is activated.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment