63 #include <OpenFlipper/widgets/glWidget/QtBaseViewer.hh>
65 #include "simpleGLGraphicsScene.hh"
68 #include "simpleViewer.hh"
77 QGraphicsView (_parent),
79 actionMode_ (
Viewer::ExamineMode)
83 initialize (QGLFormat::defaultFormat (), 0, useDefaultSceneGraph);
85 initialize (share->format(), share, useDefaultSceneGraph);
92 void SimpleViewer::resizeEvent(QResizeEvent *_event) {
93 QGraphicsView::resizeEvent(_event);
96 scene()->setSceneRect(QRect(QPoint(0, 0), _event->size()));
97 mainWidget_->setGeometry (QRect(QPoint(0, 0), _event->size()));
106 void SimpleViewer::initialize (
const QGLFormat & _format, QGLWidget *_shareWidget,
bool useDefaultSceneGraph)
109 connect (&props_, SIGNAL( getPickMode(std::string&) ),
110 this, SLOT( getPickMode(std::string&) ),Qt::DirectConnection );
111 connect (&props_, SIGNAL( getActionMode(Viewer::ActionMode&) ),
112 this, SLOT( getActionMode(Viewer::ActionMode&) ),Qt::DirectConnection );
113 connect (&props_, SIGNAL( setActionMode(
const Viewer::ActionMode) ),
114 this, SLOT( setActionMode(
const Viewer::ActionMode)), Qt::DirectConnection );
116 glWidget_ =
new QGLWidget (_format, 0, _shareWidget);
118 setFocusPolicy (Qt::StrongFocus);
119 setAcceptDrops (
true);
120 setViewport(glWidget_);
121 setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
127 mainWidget_ =
new glViewer (scene_, glWidget_, props_);
129 scene_->addItem (mainWidget_);
130 scene_->setView (mainWidget_);
131 mainWidget_->setGeometry (QRect(QPoint(0, 0), size()));
132 setFrameStyle(QFrame::NoFrame);
134 if (useDefaultSceneGraph)
137 props_.
drawMode (OpenFlipper::Options::defaultDrawMode(0));
141 unsigned int maxPases = 1;
145 mainWidget_->
sceneGraph(rootNode, maxPases, bbmin, bbmax,
true);
148 void SimpleViewer::setActionMode(
const Viewer::ActionMode _am)
153 void SimpleViewer::getActionMode(Viewer::ActionMode & _am)
158 void SimpleViewer::getPickMode(std::string & _name)
160 _name =
"SimpleViewer";
SimpleViewer(QWidget *_parent=NULL, bool useDefaultSceneGraph=true)
Constructor.
void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode)
set draw mode (No test if this mode is available!)
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
Viewer::ViewerProperties & properties()
Viewer properties.
~SimpleViewer()
Destructor.
void analyzeSceneGraph(ACG::SceneGraph::BaseNode *_root, unsigned int &_maxPasses, ACG::Vec3d &_bbmin, ACG::Vec3d &_bbmax)
void shareGLWidget(QGLWidget *_widget)
Sets the main QGLWidget for gl data sharing.
void sceneGraph(ACG::SceneGraph::BaseNode *_root, unsigned int _maxPasses, ACG::Vec3d _bbmin, ACG::Vec3d _bbmax, const bool _resetTrackBall=false)
glViewer * viewer()
Viewer.