57 #include <OpenFlipper/widgets/glWidget/QtBaseViewer.hh> 59 #include "simpleGLGraphicsScene.hh" 62 #include "simpleViewer.hh" 64 #include <QOpenGLWidget> 74 QGraphicsView (_parent),
76 actionMode_ (
Viewer::ExamineMode)
80 initialize (OFGLFormat::defaultFormat (), 0, useDefaultSceneGraph);
82 initialize (share->format(), share, useDefaultSceneGraph);
89 void SimpleViewer::resizeEvent(QResizeEvent *_event) {
90 QGraphicsView::resizeEvent(_event);
93 scene()->setSceneRect(QRect(QPoint(0, 0), _event->size()));
94 mainWidget_->setGeometry (QRect(QPoint(0, 0), _event->size()));
103 void SimpleViewer::initialize(
const OFGLFormat & _format, OFGLWidget *_shareWidget,
bool useDefaultSceneGraph)
106 connect (&props_, SIGNAL( getPickMode(std::string&) ),
107 this, SLOT( getPickMode(std::string&) ),Qt::DirectConnection );
113 glWidget_ =
new OFGLWidget();
114 glWidget_->setFormat(_format);
116 setFocusPolicy (Qt::StrongFocus);
117 setAcceptDrops (
true);
118 setViewport(glWidget_);
119 setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
125 mainWidget_ =
new glViewer (scene_, glWidget_, props_);
127 scene_->addItem (mainWidget_);
128 scene_->setView (mainWidget_);
129 mainWidget_->setGeometry (QRect(QPoint(0, 0), size()));
130 setFrameStyle(QFrame::NoFrame);
132 if (useDefaultSceneGraph)
135 props_.
drawMode (OpenFlipper::Options::defaultDrawMode(0));
139 unsigned int maxPases = 1;
143 mainWidget_->
sceneGraph(rootNode, maxPases, bbmin, bbmax,
true);
156 void SimpleViewer::getPickMode(std::string & _name)
158 _name =
"SimpleViewer";
void shareGLWidget(OFGLWidget *_widget)
Sets the main QGLWidget for gl data sharing.
SimpleViewer(QWidget *_parent=NULL, bool useDefaultSceneGraph=true)
Constructor.
ActionMode
Enum listing action modes of the viewers.
void analyzeSceneGraph(ACG::SceneGraph::BaseNode *_root, unsigned int &_maxPasses, ACG::Vec3d &_bbmin, ACG::Vec3d &_bbmax)
Analyze the SceneGraph <ACG/Scenegraph/SceneGraphAnalysis.hh>
~SimpleViewer()
Destructor.
void sceneGraph(ACG::SceneGraph::BaseNode *_root, unsigned int _maxPasses, ACG::Vec3d _bbmin, ACG::Vec3d _bbmax, const bool _resetTrackBall=false)
void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode)
set draw mode (No test if this mode is available!)
glViewer * viewer()
Viewer.
Viewer::ViewerProperties & properties()
Viewer properties.
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node