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);
229 QImage createPicture(
int width,
int height,
bool center =
true);
241 bool pickGlEntities(
const int x,
const int y,
const int width,
const int height,
242 std::vector<SelectedEntity> &pickedEntities,
tlp::GlLayer *layer =
nullptr);
251 bool pickGlEntities(
const int x,
const int y, std::vector<SelectedEntity> &pickedEntities,
257 _DEPRECATED
bool selectGlEntities(
const int x,
const int y,
const int width,
const int height,
258 std::vector<GlSimpleEntity *> &pickedEntities,
260 std::vector<SelectedEntity> entities;
261 pickGlEntities(x, y, width, height, entities, layer);
262 bool foundEntity =
false;
264 for (std::vector<SelectedEntity>::iterator it = entities.begin(); it != entities.end(); ++it) {
265 if ((*it).getEntityType() == SelectedEntity::SIMPLE_ENTITY_SELECTED) {
266 pickedEntities.push_back((*it).getSimpleEntity());
278 std::vector<GlSimpleEntity *> &pickedEntities,
280 std::vector<SelectedEntity> entities;
281 pickGlEntities(x, y, entities, layer);
282 bool foundEntity =
false;
284 for (std::vector<SelectedEntity>::iterator it = entities.begin(); it != entities.end(); ++it) {
285 if ((*it).getEntityType() == SelectedEntity::SIMPLE_ENTITY_SELECTED) {
286 pickedEntities.push_back((*it).getSimpleEntity());
298 virtual void makeCurrent();
303 void resizeGL(
int w,
int h)
override;
308 void computeInteractors();
313 void drawInteractors();
325 void render(RenderingOptions options = RenderingOptions(RenderScene | SwapBuffers),
326 bool checkVisibility =
true);
332 void setKeepScenePointOfViewOnSubgraphChanging(
bool);
337 bool keepScenePointOfViewOnSubgraphChanging()
const;
349 this->advancedAntiAliasing = advancedAntiAliasing;
356 return advancedAntiAliasing;
360 void setupOpenGlContext();
361 void createRenderingStore(
int width,
int height);
362 void deleteRenderingStore();
365 QRegion _visibleArea;
369 unsigned char *renderingStore;
370 bool frameBufferStored;
371 bool useFramebufferObject;
372 QOpenGLFramebufferObject *glFrameBuf, *glFrameBuf2;
373 static bool inRendering;
374 bool keepPointOfViewOnSubgraphChanging;
375 bool advancedAntiAliasing;
381 void draw(
bool graphChanged =
true);
391 void closeEvent(QCloseEvent *e)
override;
403 void centerScene(
bool graphChanged =
false,
float zoomFactor = 1.0);
405 void emitGraphChanged();
408 void paintEvent(QPaintEvent *)
override;
423 void viewDrawn(
GlMainWidget *glWidget,
bool graphChanged);
425 void glResized(
int w,
int h);
434 static QGLWidget *getFirstQGLWidget();
436 static void clearFirstQGLWidget();
439 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.