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>
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());
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);
292 void setKeepScenePointOfViewOnSubgraphChanging(
bool);
297 bool keepScenePointOfViewOnSubgraphChanging()
const;
307 this->advancedAntiAliasing = advancedAntiAliasing;
314 return advancedAntiAliasing;
319 void setupOpenGlContext();
320 void createRenderingStore(
int width,
int height);
321 void deleteRenderingStore();
324 QRegion _visibleArea;
328 unsigned char *renderingStore;
329 bool frameBufferStored;
330 bool useFramebufferObject;
331 QGLFramebufferObject *glFrameBuf, *glFrameBuf2;
332 static bool inRendering;
333 bool keepPointOfViewOnSubgraphChanging;
334 bool advancedAntiAliasing;
340 void draw(
bool graphChanged=
true);
351 void closeEvent(QCloseEvent *e);
362 void centerScene(
bool graphChanged =
false,
float zoomFactor = 1.0);
364 void emitGraphChanged();
367 void paintEvent( QPaintEvent* );
382 void viewDrawn(
GlMainWidget *glWidget,
bool graphChanged);
384 void glResized(
int w,
int h);
394 static QGLWidget* getFirstQGLWidget();
396 static void clearFirstQGLWidget();
399 static QGLWidget *firstQGLWidget;
bool selectGlEntities(const int x, const int y, std::vector< GlSimpleEntity * > &pickedEntities, tlp::GlLayer *layer=NULL)
bool advancedAntiAliasingActivated() const
void setAdvancedAntiAliasing(bool advancedAntiAliasing)
Specify if an advanced technique for better scene anti-aliasing has to be activated.
The edge struct represents an edge in a Graph object.
The node struct represents a node in a Graph object.
bool selectGlEntities(const int x, const int y, const int width, const int height, std::vector< GlSimpleEntity * > &pickedEntities, tlp::GlLayer *layer=NULL)
View plugins provide a way to dynamically add to a Tulip plateform various ways to visualize a graph...
Structure to store selected entities.
RenderingOption
Configure the rendering process ( see render function)
A GlLayer is like an 2D drawing software layer system.
This widget provide a simple system to visualize data/graph with OpenGL 3D engine.