/usr/include/tulip/glmainwidget.h is in libtulip-qt4-dev 3.1.2-2.3ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | //-*-c++-*-
/**
Authors: David Auber, Patrick Mary, Morgan Mathiaut
from the LaBRI Visualization Team
Email : auber@tulip-software.org
Last modification : 13/03/2009
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
/**
Author: David Auber
Email : auber@labri.fr
Last modification : 06/09/2005
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
#ifndef Tulip_GLMAINWIDGET_H
#define Tulip_GLMAINWIDGET_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <tulip/GlScene.h>
#include <QtOpenGL/qgl.h>
#include <QtCore/qpoint.h>
#include <QtGui/qaction.h>
#include "tulip/GWInteractor.h"
#include "tulip/AbstractView.h"
#include "tulip/ForegroundEntity.h"
#include <tulip/GlHierarchyConvexHulls.h>
namespace tlp {
//class QTextView;
/** \addtogroup Tulip_Widgets */
/*@{*/
class TLP_QT_SIMPLE_SCOPE GlMainWidget : public QGLWidget {
Q_OBJECT;
public:
/**
* Construct the GlMainWidget
*/
GlMainWidget(QWidget *parent,AbstractView *view=NULL);
~GlMainWidget();
/**
* Set graph and data of GlMainWidget
*/
void setData(Graph *graph,DataSet dataSet);
/**
* Get data of GlMainWidget
*/
DataSet getData();
/**
* Set the graph
*/
void setGraph(Graph *graph);
/**
* GetGraph of GlMainWidget
*/
Graph *getGraph();
/**
* Get the view who use this GlMainWidget
*/
View *getView() {return view;}
/**
* Get the scene of this glMainWidget
*/
tlp::GlScene* getScene(){return &scene;}
/**
* add a foregroundEntity to this GlMainWidget
*/
void addForegroundEntity(ForegroundEntity *entity) {foregroundEntity.push_back(entity);}
/**************************************
* inherited methods overloading
**************************************/
/** \brief select nodes and edges in a region of the screen
*
* select all nodes and edges lying in the area of the screen of given width and height,
* and with its upper-left corner at (x,y)
* \param sNode filled by the method with the nodes found in the region
* \param sEdge filled by the method with the edges found in the region
*/
void doSelect(const int x, const int y,
const int width, const int height,
std::vector<tlp::node> &sNode, std::vector<tlp::edge> &sEdge,
tlp::GlLayer* layer=NULL);
/** \brief select a node or edge at a point
* select either a node or edge at point (x,y)
* \param type tells what has been found: NODE, EDGE
* \return true if something has been found, false otherwise
*/
bool doSelect(const int x, const int y,
tlp::ElementType &type,
tlp::node &,tlp::edge &,
tlp::GlLayer* layer=NULL);
/**
* Take a snapshot of the Widget
* \return an array of dimension width*height*3 char (8bits per color RGB).
* The pointer has to be freed after (with free, not delete)
**/
unsigned char* getImage();
// EPS output of a GlGraph
bool outputEPS(int size, int doSort, const char *filename);
// SVG output of a GlGraph
bool outputSVG(int size, const char* filename);
/**
* Function to do picking on entities. It just calls
* selectEntities on the GlScene instance.
*/
bool selectGlEntities(const int x, const int y,
const int width, const int height,
std::vector<tlp::GlEntity *>
&pickedEntities,
tlp::GlLayer* layer=NULL);
/**
* Function to do picking on entities. It just calls
* selectEntities on the GlScene instance with a small window of
* twelve pixels.
*/
bool selectGlEntities(const int x, const int y,
std::vector<tlp::GlEntity *>
&pickedEntities,
tlp::GlLayer* layer=NULL);
/**
* Grab the image of this widget
*/
virtual QImage grabFrameBuffer(bool withAlpha = false);
/**
* set if the label is rendered in this widget
*/
void setViewLabel(bool viewLabel) {scene.setViewLabel(viewLabel);}
/**
* Extend makeCurrent function of QGLWidget to inform TextureManager and DisplayListManager of context changement
*/
virtual void makeCurrent();
private:
void updateGL();
void glInit();
void glDraw();
void paintGL();
void resizeGL(int w, int h);
void setupOpenGlContext();
void initializeGL();
void computeInteractors();
void drawInteractors();
void drawForegroundEntities();
tlp::GlScene scene;
tlp::GlHierarchyConvexHulls hulls;
bool _firstStepOfIncrementalRendering;
QRegion _visibleArea;
AbstractView *view;
char *renderingStore;
std::vector<ForegroundEntity *> foregroundEntity;
public slots:
/**
* Draw the graph, the augmented dispaly and the interactors
*/
void draw(bool graphChanged=true);
/**
* That function is given for optimisation purpose. If the hardware enable it,
* it enables to redraw only the Augmented display and the interactors and not the graph
* it is really usefull for interactors such as zoom box etc..
* Warning, if you change the graph or the porperties of element (Colors, size, etc...)
* applying that fonction will not display the change, in that case, use the draw function.
*/
void redraw();
void closeEvent(QCloseEvent *e);
protected slots:
void paintEvent( QPaintEvent* );
signals:
void closing(GlMainWidget *, QCloseEvent *);
void graphRedrawn(GlMainWidget *glWidget,bool graphChanged);
public :
static QGLWidget* getFirstQGLWidget();
private :
static QGLWidget *firstQGLWidget;
};
}
/*@}*/
#endif
|