Tulip  5.2.1
Large graphs analysis and drawing
GlEPSFeedBackBuilder.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_GLEPSFEEDBACKBUILDER_H
22 #define Tulip_GLEPSFEEDBACKBUILDER_H
23 #ifndef DOXYGEN_NOTFOR_DEVEL
24 
25 #include <sstream>
26 
27 #include <tulip/GlTLPFeedBackBuilder.h>
28 #include <tulip/tulipconf.h>
29 #include <tulip/Color.h>
30 
31 namespace tlp {
32 
33 /**
34  * Class to build EPS file with OpenGL feedback buffer
35  */
36 class TLP_GL_SCOPE GlEPSFeedBackBuilder : public GlTLPFeedBackBuilder {
37 
38 public:
39  GlEPSFeedBackBuilder() : stream_out(std::stringstream::in | std::stringstream::out) {}
40 
41  /**
42  * Begin new EPS document with viewport, clearColor, pointSize and lineWidth information
43  */
44  void begin(const Vector<int, 4> &viewport, GLfloat *clearColor, GLfloat pointSize,
45  GLfloat lineWidth) override;
46  /**
47  * Record a new color
48  */
49  void colorInfo(GLfloat *data) override;
50  /**
51  * Record a new GlEntity
52  */
53  void beginGlEntity(GLfloat data) override;
54  /**
55  * End of a GlEntity
56  */
57  void endGlEntity() override;
58  /**
59  * Record a new GlGraph
60  */
61  void beginGlGraph(GLfloat data) override;
62  /**
63  * End of a GlGraph
64  */
65  void endGlGraph() override;
66  /**
67  * Record a new Node
68  */
69  void beginNode(GLfloat data) override;
70  /**
71  * End of a Node
72  */
73  void endNode() override;
74  /**
75  * Record a new Edge
76  */
77  void beginEdge(GLfloat data) override;
78  /**
79  * End of a Edge
80  */
81  void endEdge() override;
82  /**
83  * Record a new pointToken
84  */
85  void pointToken(GLfloat *data) override;
86  /**
87  * Record a new lineToken
88  */
89  void lineToken(GLfloat *data) override;
90  /**
91  * Record a new lineResetToken
92  */
93  void lineResetToken(GLfloat *data) override;
94  /**
95  * Record a new polygonToken
96  */
97  void polygonToken(GLfloat *data) override;
98  /**
99  * End of the EPS document
100  */
101  void end() override;
102 
103  /**
104  * Put in str the built EPS document
105  */
106  void getResult(std::string *str) override;
107 
108 private:
109  std::stringstream stream_out;
110 
111  GLfloat pointSize;
112 
113  Color fillColor;
114  Color strokeColor;
115  Color textColor;
116 };
117 } // namespace tlp
118 
119 #endif // DOXYGEN_NOTFOR_DEVEL
120 
121 #endif // Tulip_GLEPSFEEDBACKBUILDER_H
122 ///@endcond