21 #ifndef Tulip_GLMAINWIDGET_H
22 #define Tulip_GLMAINWIDGET_H
24 #include <tulip/GlScene.h>
26 #include <QtOpenGL/qgl.h>
27 #include <QtCore/qpoint.h>
28 #include <QtGui/qaction.h>
29 #include <QtOpenGL/QGLFramebufferObject>
31 #include "tulip/View.h"
33 class QGLFramebufferObject;
37 class GlCompositeHierarchyManager;
78 Q_DECLARE_FLAGS ( RenderingOptions, RenderingOption )
109 void pickNodesEdges(
const int x,
const int y,
110 const int width,
const int height,
111 std::vector<SelectedEntity> &selectedNode, std::vector<SelectedEntity> &seletedEdge,
118 bool pickNodesEdges(
const int x,
const int y,
125 _DEPRECATED
void doSelect(
const int x,
const int y,
126 const int width,
const int height,
127 std::vector<tlp::node> &sNode, std::vector<tlp::edge> &sEdge,
129 std::vector<SelectedEntity> nodes;
130 std::vector<SelectedEntity> edges;
131 pickNodesEdges(x,y,width,height,nodes,edges,layer);
133 for(std::vector<SelectedEntity>::iterator it=nodes.begin(); it!=nodes.end(); ++it) {
134 sNode.push_back(
node((*it).getComplexEntityId()));
137 for(std::vector<SelectedEntity>::iterator it=edges.begin(); it!=edges.end(); ++it) {
138 sEdge.push_back(
edge((*it).getComplexEntityId()));
145 _DEPRECATED
bool doSelect(
const int x,
const int y,
150 bool foundEntity=pickNodesEdges(x,y,entity,layer);
155 if(entity.getEntityType()==SelectedEntity::NODE_SELECTED) {
156 n=
node(entity.getComplexEntityId());
160 e=
edge(entity.getComplexEntityId());
170 bool outputEPS(
int size,
int doSort,
const char *filename);
174 bool outputSVG(
int size,
const char* filename);
180 static void getTextureRealSize(
int width,
int height,
int &textureRealWidth,
int &textureRealHeight);
189 QGLFramebufferObject *createTexture(
const std::string &textureName,
int width,
int height);
196 void createPicture(
const std::string &pictureName,
int width,
int height,
bool center=
true);
204 QImage createPicture(
int width,
int height,
bool center=
true);
216 bool pickGlEntities(
const int x,
const int y,
217 const int width,
const int height,
218 std::vector<SelectedEntity>
229 bool pickGlEntities(
const int x,
const int y,
230 std::vector<SelectedEntity>
237 _DEPRECATED
bool selectGlEntities(
const int x,
const int y,
238 const int width,
const int height,
239 std::vector<GlSimpleEntity*> &pickedEntities,
241 std::vector<SelectedEntity> entities;
242 pickGlEntities(x,y,width,height,entities,layer);
243 bool foundEntity=
false;
245 for(std::vector<SelectedEntity>::iterator it=entities.begin(); it!=entities.end(); ++it) {
246 if((*it).getEntityType()==SelectedEntity::SIMPLE_ENTITY_SELECTED) {
247 pickedEntities.push_back((*it).getSimpleEntity());
258 _DEPRECATED
bool selectGlEntities(
const int x,
const int y,
259 std::vector<GlSimpleEntity*> &pickedEntities,
261 std::vector<SelectedEntity> entities;
262 pickGlEntities(x,y,entities,layer);
263 bool foundEntity=
false;
265 for(std::vector<SelectedEntity>::iterator it=entities.begin(); it!=entities.end(); ++it) {
266 if((*it).getEntityType()==SelectedEntity::SIMPLE_ENTITY_SELECTED) {
267 pickedEntities.push_back((*it).getSimpleEntity());
279 virtual QImage grabFrameBuffer(
bool withAlpha =
false);
285 virtual void makeCurrent();
290 void resizeGL(
int w,
int h);
295 void computeInteractors();
300 void drawInteractors();
309 void render(RenderingOptions options=RenderingOptions(RenderScene|SwapBuffers),
bool checkVisibility=
true);
313 void setupOpenGlContext();
314 void createRenderingStore(
int width,
int height);
317 QRegion _visibleArea;
321 char *renderingStore;
322 bool frameBufferStored;
323 bool useFramebufferObject;
324 QGLFramebufferObject *glFrameBuf;
325 static bool inRendering;
332 void draw(
bool graphChanged=
true);
343 void closeEvent(QCloseEvent *e);
353 void centerScene(
bool graphChanged =
false);
355 void emitGraphChanged();
358 void paintEvent( QPaintEvent* );
373 void viewDrawn(
GlMainWidget *glWidget,
bool graphChanged);
375 void glResized(
int w,
int h);
385 static QGLWidget* getFirstQGLWidget();
387 static void clearFirstQGLWidget();
390 static QGLWidget *firstQGLWidget;