20 #ifndef Tulip_GLMAINWIDGET_H 21 #define Tulip_GLMAINWIDGET_H 25 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 29 #include <tulip/tulipconf.h> 30 #include <tulip/GlScene.h> 31 #include <tulip/Graph.h> 33 class QGLFramebufferObject;
38 class GlCompositeHierarchyManager;
113 void pickNodesEdges(
const int x,
const int y,
114 const int width,
const int height,
115 std::vector<SelectedEntity> &selectedNodes, std::vector<SelectedEntity> &selectedEdges,
116 tlp::GlLayer* layer=NULL,
bool pickNodes=
true,
bool pickEdges=
true);
126 bool pickNodesEdges(
const int x,
const int y,
129 bool pickNodes=
true,
bool pickEdges=
true);
134 _DEPRECATED
void doSelect(
const int x,
const int y,
135 const int width,
const int height,
136 std::vector<tlp::node> &sNode, std::vector<tlp::edge> &sEdge,
142 _DEPRECATED
bool doSelect(
const int x,
const int y,
154 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 155 return l * windowHandle()->devicePixelRatio();
167 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 168 return l * windowHandle()->devicePixelRatio();
180 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 181 qreal dpr = windowHandle()->devicePixelRatio();
182 return Coord(point.x() * dpr, point.y() * dpr);
194 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 195 return l / windowHandle()->devicePixelRatio();
207 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 208 qreal dpr = windowHandle()->devicePixelRatio();
209 return Coord(point.x() / dpr, point.y() / dpr);
218 bool outputEPS(
int size,
int doSort,
const char *filename);
222 bool outputSVG(
int size,
const char* filename);
228 static void getTextureRealSize(
int width,
int height,
int &textureRealWidth,
int &textureRealHeight);
237 QGLFramebufferObject *createTexture(
const std::string &textureName,
int width,
int height);
244 void createPicture(
const std::string &pictureName,
int width,
int height,
bool center=
true);
252 QImage createPicture(
int width,
int height,
bool center=
true);
264 bool pickGlEntities(
const int x,
const int y,
265 const int width,
const int height,
266 std::vector<SelectedEntity>
277 bool pickGlEntities(
const int x,
const int y,
278 std::vector<SelectedEntity>
286 const int width,
const int height,
287 std::vector<GlSimpleEntity*> &pickedEntities,
289 std::vector<SelectedEntity> entities;
290 pickGlEntities(x,y,width,height,entities,layer);
291 bool foundEntity=
false;
293 for(std::vector<SelectedEntity>::iterator it=entities.begin(); it!=entities.end(); ++it) {
294 if((*it).getEntityType()==SelectedEntity::SIMPLE_ENTITY_SELECTED) {
295 pickedEntities.push_back((*it).getSimpleEntity());
307 std::vector<GlSimpleEntity*> &pickedEntities,
309 std::vector<SelectedEntity> entities;
310 pickGlEntities(x,y,entities,layer);
311 bool foundEntity=
false;
313 for(std::vector<SelectedEntity>::iterator it=entities.begin(); it!=entities.end(); ++it) {
314 if((*it).getEntityType()==SelectedEntity::SIMPLE_ENTITY_SELECTED) {
315 pickedEntities.push_back((*it).getSimpleEntity());
327 virtual QImage grabFrameBuffer(
bool withAlpha =
false);
333 virtual void makeCurrent();
338 void resizeGL(
int w,
int h);
343 void computeInteractors();
348 void drawInteractors();
357 void render(RenderingOptions options=RenderingOptions(RenderScene|SwapBuffers),
bool checkVisibility=
true);
363 void setKeepScenePointOfViewOnSubgraphChanging(
bool);
368 bool keepScenePointOfViewOnSubgraphChanging()
const;
378 this->advancedAntiAliasing = advancedAntiAliasing;
385 return advancedAntiAliasing;
390 void setupOpenGlContext();
391 void createRenderingStore(
int width,
int height);
392 void deleteRenderingStore();
395 QRegion _visibleArea;
399 unsigned char *renderingStore;
400 bool frameBufferStored;
401 bool useFramebufferObject;
402 QGLFramebufferObject *glFrameBuf, *glFrameBuf2;
403 static bool inRendering;
404 bool keepPointOfViewOnSubgraphChanging;
405 bool advancedAntiAliasing;
411 void draw(
bool graphChanged=
true);
422 void closeEvent(QCloseEvent *e);
433 void centerScene(
bool graphChanged =
false,
float zoomFactor = 1.0);
435 void emitGraphChanged();
438 void paintEvent( QPaintEvent* );
453 void viewDrawn(
GlMainWidget *glWidget,
bool graphChanged);
455 void glResized(
int w,
int h);
465 static QGLWidget* getFirstQGLWidget();
467 static void clearFirstQGLWidget();
470 static QGLWidget *firstQGLWidget;
double viewportToScreen(double l)
convert a viewport measure into a screen measure
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)
double screenToViewport(double l)
convert a screen measure into a viewport measure
View plugins provide a way to dynamically add to a Tulip plateform various ways to visualize a graph...
int screenToViewport(int l)
convert a screen measure into a viewport measure
Structure to store selected entities.
RenderingOption
Configure the rendering process ( see render function)
A GlLayer is like an 2D drawing software layer system.
Coord viewportToScreen(const Coord &point)
convert a viewport point into a screen point
Coord screenToViewport(const Coord &point)
convert a screen point into a viewport point
This widget provide a simple system to visualize data/graph with OpenGL 3D engine.