21 #ifndef Tulip_GLVERTEXARRAYMANAGER_H 22 #define Tulip_GLVERTEXARRAYMANAGER_H 24 #include <tulip/OpenGlIncludes.h> 26 #include <tulip/Coord.h> 27 #include <tulip/Color.h> 28 #include <tulip/Observable.h> 29 #include <tulip/tuliphash.h> 38 class GlGraphInputData;
39 class PropertyInterface;
43 class IntegerProperty;
50 class TLP_GL_SCOPE GlVertexArrayManager :
private Observable {
58 GlVertexArrayManager(GlGraphInputData *inputData);
60 ~GlVertexArrayManager();
65 void setInputData(GlGraphInputData *inputData);
70 inline bool renderingIsBegin() {
82 void setHaveToComputeAll(
bool compute);
86 void setHaveToComputeLayout(
bool compute);
90 void setHaveToComputeColor(
bool compute);
96 void beginRendering();
106 void addEdge(GlEdge *edge);
110 void addNode(GlNode *node);
116 void pauseRendering(
bool pause);
121 void activate(
bool act);
130 void activateLineEdgeDisplay(GlEdge *edge,
bool selected);
134 void activateQuadEdgeDisplay(GlEdge *edge,
bool selected);
138 void activatePointEdgeDisplay(GlEdge *edge,
bool selected);
142 void activatePointNodeDisplay(GlNode *node,
bool selected);
147 void treatEvent(
const Event&);
149 void clearLayoutData();
150 void clearColorData();
152 void initObservers();
153 void clearObservers(PropertyInterface *deletedProperty=NULL);
155 GlGraphInputData *inputData;
158 LayoutProperty* layoutProperty;
159 SizeProperty* sizeProperty;
160 IntegerProperty* shapeProperty;
161 DoubleProperty* rotationProperty;
162 ColorProperty* colorProperty;
163 ColorProperty* borderColorProperty;
164 DoubleProperty* borderWidthProperty;
165 IntegerProperty *srcAnchorShapeProperty;
166 IntegerProperty *tgtAnchorShapeProperty;
167 SizeProperty *srcAnchorSizeProperty;
168 SizeProperty *tgtAnchorSizeProperty;
169 bool graphObserverActivated;
170 bool layoutObserverActivated;
171 bool colorObserverActivated;
176 bool toComputeLayout;
179 bool vectorLayoutSizeInit;
180 bool vectorColorSizeInit;
181 bool vectorIndexSizeInit;
184 bool colorInterpolate;
185 bool sizeInterpolate;
189 std::vector<Coord> linesCoordsArray;
190 std::vector<Color> linesColorsArray;
191 std::vector<GLint> linesIndexArray;
192 std::vector<GLsizei> linesIndexCountArray;
194 std::vector<GLuint> linesRenderingIndicesArray;
195 std::vector<GLuint> linesSelectedRenderingIndicesArray;
197 std::vector<Coord> quadsCoordsArray;
198 std::vector<Color> quadsColorsArray;
199 std::vector<Color> quadsOutlineColorsArray;
200 std::vector<GLuint> quadsIndexArray;
201 std::vector<GLsizei> quadsIndexCountArray;
202 std::vector<std::vector<GLuint> > quadsBottomOutlineIndexArray;
203 std::vector<std::vector<GLuint> > quadsTopOutlineIndexArray;
205 std::vector<GLuint> quadsRenderingIndicesArray;
206 std::vector<GLuint> quadsSelectedRenderingIndicesArray;
208 std::map<float, std::vector<GLuint> > quadsOutlineRenderingIndicesArray;
209 std::map<float, std::vector<GLuint> > quadsSelectedOutlineRenderingIndicesArray;
211 std::vector<Coord> pointsCoordsArray;
212 std::vector<Color> pointsColorsArray;
214 std::vector<GLuint> pointsNodesRenderingIndexArray;
215 std::vector<GLuint> pointsNodesSelectedRenderingIndexArray;
216 std::vector<GLuint> pointsEdgesRenderingIndexArray;
217 std::vector<GLuint> pointsEdgesSelectedRenderingIndexArray;
219 TLP_HASH_MAP<unsigned int, std::pair<unsigned int,unsigned int> > edgeToLineIndexVector;
220 TLP_HASH_MAP<unsigned int, std::pair<unsigned int,unsigned int> > edgeToQuadIndexVector;
221 TLP_HASH_MAP<unsigned int, unsigned int> edgeToBottomOulineIndexVector;
222 TLP_HASH_MAP<unsigned int, unsigned int> edgeToTopOutlineIndexVector;
223 TLP_HASH_MAP<unsigned int, unsigned int> edgeToPointIndexVector;
224 TLP_HASH_MAP<unsigned int, unsigned int> nodeToPointIndexVector;
226 GLuint pointsVerticesVBO;
227 GLuint pointsColorsVBO;
228 GLuint linesVerticesVBO;
229 GLuint linesColorsVBO;
230 GLuint quadsVerticesVBO;
231 GLuint quadsColorsVBO;
232 GLuint quadsOutlineColorsVBO;
234 bool pointsVerticesUploaded;
235 bool pointsColorsUploaded;
236 bool linesVerticesUploaded;
237 bool linesColorsUploaded;
238 bool quadsVerticesUploaded;
239 bool quadsColorsUploaded;
240 bool quadsOutlineColorsUploaded;
242 bool verticesUploadNeeded;
243 bool colorsUploadNeeded;
PropertyInterface describes the interface of a graph property.