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 QOpenGLFramebufferObject;
35 class GlCompositeHierarchyManager;
114 void pickNodesEdges(
const int x,
const int y,
const int width,
const int height,
115 std::vector<SelectedEntity> &selectedNodes,
116 std::vector<SelectedEntity> &selectedEdges,
tlp::GlLayer *layer =
nullptr,
117 bool pickNodes =
true,
bool pickEdges =
true);
127 bool pickNodesEdges(
const int x,
const int y,
SelectedEntity &selectedEntity,
128 tlp::GlLayer *layer =
nullptr,
bool pickNodes =
true,
bool pickEdges =
true);
133 _DEPRECATED
void doSelect(
const int x,
const int y,
const int width,
const int height,
134 std::vector<tlp::node> &sNode, std::vector<tlp::edge> &sEdge,
149 return l * windowHandle()->devicePixelRatio();
158 return l * windowHandle()->devicePixelRatio();
167 qreal dpr = windowHandle()->devicePixelRatio();
168 return Coord(point.x() * dpr, point.y() * dpr);
177 return l / windowHandle()->devicePixelRatio();
186 qreal dpr = windowHandle()->devicePixelRatio();
187 return Coord(point.x() / dpr, point.y() / dpr);
193 bool outputEPS(
int size,
int doSort,
const char *filename);
197 bool outputSVG(
int size,
const char *filename);
204 static void getTextureRealSize(
int width,
int height,
int &textureRealWidth,
205 int &textureRealHeight);
214 QOpenGLFramebufferObject *createTexture(
const std::string &textureName,
int width,
int height);
221 void createPicture(
const std::string &pictureName,
int width,
int height,
bool center =
true);
230 QImage createPicture(
int width,
int height,
bool center =
true,
231 QImage::Format format = QImage::Format_RGB32);
243 bool pickGlEntities(
const int x,
const int y,
const int width,
const int height,
244 std::vector<SelectedEntity> &pickedEntities,
tlp::GlLayer *layer =
nullptr);
253 bool pickGlEntities(
const int x,
const int y, std::vector<SelectedEntity> &pickedEntities,
259 _DEPRECATED
bool selectGlEntities(
const int x,
const int y,
const int width,
const int height,
260 std::vector<GlSimpleEntity *> &pickedEntities,
262 std::vector<SelectedEntity> entities;
263 pickGlEntities(x, y, width, height, entities, layer);
264 bool foundEntity =
false;
266 for (std::vector<SelectedEntity>::iterator it = entities.begin(); it != entities.end(); ++it) {
267 if ((*it).getEntityType() == SelectedEntity::SIMPLE_ENTITY_SELECTED) {
268 pickedEntities.push_back((*it).getSimpleEntity());
280 std::vector<GlSimpleEntity *> &pickedEntities,
282 std::vector<SelectedEntity> entities;
283 pickGlEntities(x, y, entities, layer);
284 bool foundEntity =
false;
286 for (std::vector<SelectedEntity>::iterator it = entities.begin(); it != entities.end(); ++it) {
287 if ((*it).getEntityType() == SelectedEntity::SIMPLE_ENTITY_SELECTED) {
288 pickedEntities.push_back((*it).getSimpleEntity());
300 virtual void makeCurrent();
305 void resizeGL(
int w,
int h)
override;
310 void computeInteractors();
315 void drawInteractors();
327 void render(RenderingOptions options = RenderingOptions(RenderScene | SwapBuffers),
328 bool checkVisibility =
true);
334 void setKeepScenePointOfViewOnSubgraphChanging(
bool);
339 bool keepScenePointOfViewOnSubgraphChanging()
const;
351 this->advancedAntiAliasing = advancedAntiAliasing;
358 return advancedAntiAliasing;
362 void setupOpenGlContext();
363 void createRenderingStore(
int width,
int height);
364 void deleteRenderingStore();
367 QRegion _visibleArea;
371 unsigned char *renderingStore;
372 bool frameBufferStored;
373 bool useFramebufferObject;
374 QOpenGLFramebufferObject *glFrameBuf, *glFrameBuf2;
375 static bool inRendering;
376 bool keepPointOfViewOnSubgraphChanging;
377 bool advancedAntiAliasing;
383 void draw(
bool graphChanged =
true);
393 void closeEvent(QCloseEvent *e)
override;
405 void centerScene(
bool graphChanged =
false,
float zoomFactor = 1.0);
407 void emitGraphChanged();
410 void paintEvent(QPaintEvent *)
override;
425 void viewDrawn(
GlMainWidget *glWidget,
bool graphChanged);
427 void glResized(
int w,
int h);
436 static QGLWidget *getFirstQGLWidget();
438 static void clearFirstQGLWidget();
441 static QGLWidget *firstQGLWidget;
tlp::GlScene * getScene()
Get the GlScene of this GlMainWidget You have to add yours GlLayer and GlEntity to this GlScene At th...
double viewportToScreen(double l)
convert a viewport measure into a screen measure
bool selectGlEntities(const int x, const int y, const int width, const int height, std::vector< GlSimpleEntity *> &pickedEntities, tlp::GlLayer *layer=nullptr)
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 advancedAntiAliasingActivated() const
double screenToViewport(double l)
convert a screen measure into a viewport measure
bool selectGlEntities(const int x, const int y, std::vector< GlSimpleEntity *> &pickedEntities, tlp::GlLayer *layer=nullptr)
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.