20 #ifndef Tulip_GLMAINWIDGET_H
21 #define Tulip_GLMAINWIDGET_H
26 #include <tulip/tulipconf.h>
27 #include <tulip/GlScene.h>
28 #include <tulip/Graph.h>
30 class QGLFramebufferObject;
35 class GlCompositeHierarchyManager;
76 Q_DECLARE_FLAGS ( RenderingOptions, RenderingOption )
110 void pickNodesEdges(
const int x,
const int y,
111 const int width,
const int height,
112 std::vector<SelectedEntity> &selectedNodes, std::vector<SelectedEntity> &selectedEdges,
113 tlp::GlLayer* layer=NULL,
bool pickNodes=
true,
bool pickEdges=
true);
123 bool pickNodesEdges(
const int x,
const int y,
126 bool pickNodes=
true,
bool pickEdges=
true);
131 _DEPRECATED
void doSelect(
const int x,
const int y,
132 const int width,
const int height,
133 std::vector<tlp::node> &sNode, std::vector<tlp::edge> &sEdge,
139 _DEPRECATED
bool doSelect(
const int x,
const int y,
147 bool outputEPS(
int size,
int doSort,
const char *filename);
151 bool outputSVG(
int size,
const char* filename);
157 static void getTextureRealSize(
int width,
int height,
int &textureRealWidth,
int &textureRealHeight);
166 QGLFramebufferObject *createTexture(
const std::string &textureName,
int width,
int height);
173 void createPicture(
const std::string &pictureName,
int width,
int height,
bool center=
true);
181 QImage createPicture(
int width,
int height,
bool center=
true);
193 bool pickGlEntities(
const int x,
const int y,
194 const int width,
const int height,
195 std::vector<SelectedEntity>
206 bool pickGlEntities(
const int x,
const int y,
207 std::vector<SelectedEntity>
214 _DEPRECATED
bool selectGlEntities(
const int x,
const int y,
215 const int width,
const int height,
216 std::vector<GlSimpleEntity*> &pickedEntities,
218 std::vector<SelectedEntity> entities;
219 pickGlEntities(x,y,width,height,entities,layer);
220 bool foundEntity=
false;
222 for(std::vector<SelectedEntity>::iterator it=entities.begin(); it!=entities.end(); ++it) {
223 if((*it).getEntityType()==SelectedEntity::SIMPLE_ENTITY_SELECTED) {
224 pickedEntities.push_back((*it).getSimpleEntity());
235 _DEPRECATED
bool selectGlEntities(
const int x,
const int y,
236 std::vector<GlSimpleEntity*> &pickedEntities,
238 std::vector<SelectedEntity> entities;
239 pickGlEntities(x,y,entities,layer);
240 bool foundEntity=
false;
242 for(std::vector<SelectedEntity>::iterator it=entities.begin(); it!=entities.end(); ++it) {
243 if((*it).getEntityType()==SelectedEntity::SIMPLE_ENTITY_SELECTED) {
244 pickedEntities.push_back((*it).getSimpleEntity());
256 virtual QImage grabFrameBuffer(
bool withAlpha =
false);
262 virtual void makeCurrent();
267 void resizeGL(
int w,
int h);
272 void computeInteractors();
277 void drawInteractors();
286 void render(RenderingOptions options=RenderingOptions(RenderScene|SwapBuffers),
bool checkVisibility=
true);
290 void setupOpenGlContext();
291 void createRenderingStore(
int width,
int height);
294 QRegion _visibleArea;
298 char *renderingStore;
299 bool frameBufferStored;
300 bool useFramebufferObject;
301 QGLFramebufferObject *glFrameBuf;
302 static bool inRendering;
309 void draw(
bool graphChanged=
true);
320 void closeEvent(QCloseEvent *e);
331 void centerScene(
bool graphChanged =
false,
float zoomFactor = 1.0);
333 void emitGraphChanged();
336 void paintEvent( QPaintEvent* );
351 void viewDrawn(
GlMainWidget *glWidget,
bool graphChanged);
353 void glResized(
int w,
int h);
363 static QGLWidget* getFirstQGLWidget();
365 static void clearFirstQGLWidget();
368 static QGLWidget *firstQGLWidget;