20 #ifndef Tulip_GLMAINWIDGET_H 21 #define Tulip_GLMAINWIDGET_H 24 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 28 #include <tulip/tulipconf.h> 29 #include <tulip/GlScene.h> 30 #include <tulip/Graph.h> 32 class QGLFramebufferObject;
37 class GlCompositeHierarchyManager;
117 void pickNodesEdges(
const int x,
const int y,
const int width,
const int height,
118 std::vector<SelectedEntity> &selectedNodes,
119 std::vector<SelectedEntity> &selectedEdges,
tlp::GlLayer *layer =
nullptr,
120 bool pickNodes =
true,
bool pickEdges =
true);
130 bool pickNodesEdges(
const int x,
const int y,
SelectedEntity &selectedEntity,
131 tlp::GlLayer *layer =
nullptr,
bool pickNodes =
true,
bool pickEdges =
true);
136 _DEPRECATED
void doSelect(
const int x,
const int y,
const int width,
const int height,
137 std::vector<tlp::node> &sNode, std::vector<tlp::edge> &sEdge,
152 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 153 return l * windowHandle()->devicePixelRatio();
165 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 166 return l * windowHandle()->devicePixelRatio();
178 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 179 qreal dpr = windowHandle()->devicePixelRatio();
180 return Coord(point.x() * dpr, point.y() * dpr);
192 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 193 return l / windowHandle()->devicePixelRatio();
205 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 206 qreal dpr = windowHandle()->devicePixelRatio();
207 return Coord(point.x() / dpr, point.y() / dpr);
216 bool outputEPS(
int size,
int doSort,
const char *filename);
220 bool outputSVG(
int size,
const char *filename);
227 static void getTextureRealSize(
int width,
int height,
int &textureRealWidth,
228 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,
const int width,
const int height,
265 std::vector<SelectedEntity> &pickedEntities,
tlp::GlLayer *layer =
nullptr);
274 bool pickGlEntities(
const int x,
const int y, std::vector<SelectedEntity> &pickedEntities,
280 _DEPRECATED
bool selectGlEntities(
const int x,
const int y,
const int width,
const int height,
281 std::vector<GlSimpleEntity *> &pickedEntities,
283 std::vector<SelectedEntity> entities;
284 pickGlEntities(x, y, width, height, entities, layer);
285 bool foundEntity =
false;
287 for (std::vector<SelectedEntity>::iterator it = entities.begin(); it != entities.end(); ++it) {
288 if ((*it).getEntityType() == SelectedEntity::SIMPLE_ENTITY_SELECTED) {
289 pickedEntities.push_back((*it).getSimpleEntity());
301 std::vector<GlSimpleEntity *> &pickedEntities,
303 std::vector<SelectedEntity> entities;
304 pickGlEntities(x, y, entities, layer);
305 bool foundEntity =
false;
307 for (std::vector<SelectedEntity>::iterator it = entities.begin(); it != entities.end(); ++it) {
308 if ((*it).getEntityType() == SelectedEntity::SIMPLE_ENTITY_SELECTED) {
309 pickedEntities.push_back((*it).getSimpleEntity());
321 virtual QImage grabFrameBuffer(
bool withAlpha =
false);
327 virtual void makeCurrent();
332 void resizeGL(
int w,
int h)
override;
337 void computeInteractors();
342 void drawInteractors();
354 void render(RenderingOptions options = RenderingOptions(RenderScene | SwapBuffers),
355 bool checkVisibility =
true);
361 void setKeepScenePointOfViewOnSubgraphChanging(
bool);
366 bool keepScenePointOfViewOnSubgraphChanging()
const;
378 this->advancedAntiAliasing = advancedAntiAliasing;
385 return advancedAntiAliasing;
389 void setupOpenGlContext();
390 void createRenderingStore(
int width,
int height);
391 void deleteRenderingStore();
394 QRegion _visibleArea;
398 unsigned char *renderingStore;
399 bool frameBufferStored;
400 bool useFramebufferObject;
401 QGLFramebufferObject *glFrameBuf, *glFrameBuf2;
402 static bool inRendering;
403 bool keepPointOfViewOnSubgraphChanging;
404 bool advancedAntiAliasing;
410 void draw(
bool graphChanged =
true);
420 void closeEvent(QCloseEvent *e)
override;
432 void centerScene(
bool graphChanged =
false,
float zoomFactor = 1.0);
434 void emitGraphChanged();
437 void paintEvent(QPaintEvent *)
override;
452 void viewDrawn(
GlMainWidget *glWidget,
bool graphChanged);
454 void glResized(
int w,
int h);
463 static QGLWidget *getFirstQGLWidget();
465 static void clearFirstQGLWidget();
468 static QGLWidget *firstQGLWidget;
bool selectGlEntities(const int x, const int y, const int width, const int height, std::vector< GlSimpleEntity * > &pickedEntities, tlp::GlLayer *layer=nullptr)
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=nullptr)
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.
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.