20 #ifndef Tulip_GLMAINWIDGET_H
21 #define Tulip_GLMAINWIDGET_H
23 #include <QOpenGLWidget>
25 #include <tulip/tulipconf.h>
26 #include <tulip/GlScene.h>
27 #include <tulip/Graph.h>
29 class QOpenGLFramebufferObject;
34 class GlCompositeHierarchyManager;
79 Q_DECLARE_FLAGS(RenderingOptions, RenderingOption)
113 void pickNodesEdges(
const int x,
const int y,
const int width,
const int height,
114 std::vector<SelectedEntity> &selectedNodes,
115 std::vector<SelectedEntity> &selectedEdges,
tlp::GlLayer *layer =
nullptr,
116 bool pickNodes =
true,
bool pickEdges =
true);
126 bool pickNodesEdges(
const int x,
const int y,
SelectedEntity &selectedEntity,
127 tlp::GlLayer *layer =
nullptr,
bool pickNodes =
true,
bool pickEdges =
true);
135 return l * devicePixelRatio();
144 return l * devicePixelRatio();
153 qreal dpr = devicePixelRatio();
154 return Coord(point.x() * dpr, point.y() * dpr);
163 return l / devicePixelRatio();
172 qreal dpr = devicePixelRatio();
173 return Coord(point.x() / dpr, point.y() / dpr);
181 static void getTextureRealSize(
int width,
int height,
int &textureRealWidth,
182 int &textureRealHeight);
190 void createPicture(
const std::string &pictureName,
int width,
int height,
bool center =
true);
199 QImage createPicture(
int width,
int height,
bool center =
true,
200 QImage::Format format = QImage::Format_RGB32);
212 bool pickGlEntities(
const int x,
const int y,
const int width,
const int height,
213 std::vector<SelectedEntity> &pickedEntities,
tlp::GlLayer *layer =
nullptr);
222 bool pickGlEntities(
const int x,
const int y, std::vector<SelectedEntity> &pickedEntities,
240 void resizeGL(
int w,
int h)
override;
245 void computeInteractors();
250 void drawInteractors();
262 void render(RenderingOptions options = RenderingOptions(RenderScene | SwapBuffers),
263 bool checkVisibility =
true);
269 void setKeepScenePointOfViewOnSubgraphChanging(
bool);
274 bool keepScenePointOfViewOnSubgraphChanging()
const;
277 void createFramebuffers(
int width,
int height);
278 void deleteFramebuffers();
281 QRegion _visibleArea;
285 bool frameBufferStored;
286 QOpenGLFramebufferObject *glFrameBuf, *glFrameBuf2;
287 static bool inRendering;
288 bool keepPointOfViewOnSubgraphChanging;
289 std::string sceneTextureId;
295 void draw(
bool graphChanged =
true);
305 void closeEvent(QCloseEvent *e)
override;
317 void centerScene(
bool graphChanged =
false,
float zoomFactor = 1.0);
319 void emitGraphChanged();
322 void paintEvent(QPaintEvent *)
override;
337 void viewDrawn(
GlMainWidget *glWidget,
bool graphChanged);
339 void glResized(
int w,
int h);