Tulip  5.2.0
Large graphs analysis and drawing
GlSVGFeedBackBuilder.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef Tulip_GLSVGFEEDBACKBUILDER_H
22 #define Tulip_GLSVGFEEDBACKBUILDER_H
23 
24 #ifndef DOXYGEN_NOTFOR_DEVEL
25 
26 #include <sstream>
27 
28 #include <tulip/GlTLPFeedBackBuilder.h>
29 #include <tulip/Color.h>
30 
31 namespace tlp {
32 
33 class TLP_GL_SCOPE GlSVGFeedBackBuilder : public GlTLPFeedBackBuilder {
34 
35 public:
36  GlSVGFeedBackBuilder()
37  : stream_out(std::stringstream::in | std::stringstream::out), inGlEntity(false),
38  inGlGraph(false), inNode(false), inEdge(false) {}
39 
40  void begin(const Vector<int, 4> &viewport, GLfloat *clearColor, GLfloat pointSize,
41  GLfloat lineWidth) override;
42  void colorInfo(GLfloat *data) override;
43  void beginGlEntity(GLfloat data) override;
44  void endGlEntity() override;
45  void beginGlGraph(GLfloat data) override;
46  void endGlGraph() override;
47  void beginNode(GLfloat data) override;
48  void endNode() override;
49  void beginEdge(GLfloat data) override;
50  void endEdge() override;
51  void pointToken(GLfloat *data) override;
52  void lineToken(GLfloat *data) override;
53  void lineResetToken(GLfloat *data) override;
54  void polygonToken(GLfloat *data) override;
55  void bitmapToken(GLfloat *data) override;
56  void drawPixelToken(GLfloat *data) override;
57  void copyPixelToken(GLfloat *data) override;
58  void end() override;
59 
60  void getResult(std::string *str) override;
61 
62 private:
63  std::stringstream stream_out;
64 
65  GLfloat clearColor[4];
66  GLfloat pointSize;
67  GLfloat lineWidth;
68 
69  Color fillColor;
70  Color strokeColor;
71  Color textColor;
72 
73  bool inGlEntity;
74  bool inGlGraph;
75  bool inNode;
76  bool inEdge;
77 
78  int width;
79  int height;
80 };
81 }
82 
83 #endif // DOXYGEN_NOTFOR_DEVEL
84 
85 #endif // Tulip_GLFEEDBACKBUILDER_H
86 ///@endcond