Commit 1a2eebee authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[ADD] separate scene nodes for WQtNavGLWidgets and provided nice access to

scenes of viewers
parent 2a7d12b2
......@@ -124,14 +124,15 @@ osg::ref_ptr<osg::Camera> WGEViewer::getCamera()
return m_View->getCamera();
}
void WGEViewer::setScene( osg::ref_ptr<osg::Node> node )
void WGEViewer::setScene( osg::ref_ptr< WGEGroupNode > node )
{
m_View->setSceneData( node );
m_scene = node;
}
osg::ref_ptr<osg::Node> WGEViewer::getNode()
osg::ref_ptr< WGEGroupNode > WGEViewer::getScene()
{
return m_View->getSceneData();
return m_scene;
}
void WGEViewer::setBgColor( WColor bgColor )
......
......@@ -46,6 +46,7 @@
#include "WGECamera.h"
#include "WMarkHandler.h"
#include "WPickHandler.h"
#include "WGEGroupNode.h"
......@@ -136,14 +137,14 @@ public:
*
* \param node part of the scene graph
*/
void setScene( osg::ref_ptr<osg::Node> node );
void setScene( osg::ref_ptr< WGEGroupNode > node );
/**
* Returns the currently set OSG node.
*
* \return the node.
*/
osg::ref_ptr<osg::Node> getNode();
osg::ref_ptr< WGEGroupNode > getScene();
/**
* Returns the name of the viewer.
......@@ -193,6 +194,11 @@ protected:
*/
osg::ref_ptr<WMarkHandler> m_markHandler;
/**
* reference to the scene which is displayed by viewer
*/
osg::ref_ptr< WGEGroupNode > m_scene;
private:
};
......
......@@ -31,6 +31,7 @@
#include <QtGui/QKeyEvent>
#include "WQtNavGLWidget.h"
#include "../../graphicsEngine/WGEViewer.h"
WQtNavGLWidget::WQtNavGLWidget( QString title, QWidget* parent, int maxValue, std::string sliderTitle )
: QDockWidget( title, parent )
......@@ -47,9 +48,36 @@ WQtNavGLWidget::WQtNavGLWidget( QString title, QWidget* parent, int maxValue, st
QVBoxLayout* layout = new QVBoxLayout();
m_glWidget = boost::shared_ptr<WQtGLWidget>( new WQtGLWidget( title.toStdString(), panel, WGECamera::ORTHOGRAPHIC ) );
m_glWidget->initialize();
m_scene = new WGEGroupNode();
m_scene->setDataVariance( osg::Object::DYNAMIC );
m_glWidget->getViewer()->setScene( m_scene );
//
// TODO(wiebel): set the view direction of the camera correctly
//
// m_glWidget->getViewer()->getCamera()->setProjectionMatrix( osg::Matrix::ortho( -200.0, 200.0, -200.0, 200.0, 0.0, 1000.0) );
// std::cout << title.toStdString() << " ..................." << std::endl;
// osg::Vec3d center( 80., 100., 80. );
// if( title == QString( "axial" ) )
// {
// std::cout << "ax..." << std::endl;
// m_glWidget->getViewer()->getCamera()->setViewMatrix( osg::Matrix::lookAt( osg::Vec3d( -100., 0., 0. ), center, osg::Vec3d( 0., 0., 1. ) ) );
// }
// if( title == QString( "sagittal" ) )
// {
// std::cout << "sa..." << std::endl;
// m_glWidget->getViewer()->getCamera()->setViewMatrix( osg::Matrix::lookAt( osg::Vec3d( 0., -100., 0. ), center, osg::Vec3d( 0., 0., 1. ) ) );
// }
// if( title == QString( "coronal" ) )
// {
// std::cout << "cor..." << std::endl;
// m_glWidget->getViewer()->getCamera()->setViewMatrix( osg::Matrix::lookAt( osg::Vec3d( 0., 0., -100. ), center, osg::Vec3d( 1., 0., 0. ) ) );
// }
layout->addWidget( m_glWidget.get() );
layout->addWidget( slider );
......
......@@ -27,9 +27,10 @@
#include <string>
#include "WQtGLWidget.h"
#include <QtGui/QDockWidget>
#include "../../graphicsEngine/WGEGroupNode.h"
#include "WQtGLWidget.h"
/**
* container widget to hold as GL widget and a slider
*/
......@@ -88,6 +89,11 @@ private:
*/
boost::shared_ptr<WQtGLWidget> m_glWidget;
/**
* the scene which is displayed by the GL widget
*/
osg::ref_ptr< WGEGroupNode > m_scene;
private slots:
/**
......
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