Tulip  5.1.0
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 
40  GlEPSFeedBackBuilder()
41  :stream_out(std::stringstream::in | std::stringstream::out) {}
42 
43  /**
44  * Begin new EPS document with viewport, clearColor, pointSize and lineWidth information
45  */
46  virtual void begin(const Vector<int, 4> &viewport,GLfloat *clearColor,GLfloat pointSize,GLfloat lineWidth);
47  /**
48  * Record a new color
49  */
50  virtual void colorInfo(GLfloat *data);
51  /**
52  * Record a new GlEntity
53  */
54  virtual void beginGlEntity(GLfloat data);
55  /**
56  * End of a GlEntity
57  */
58  virtual void endGlEntity();
59  /**
60  * Record a new GlGraph
61  */
62  virtual void beginGlGraph(GLfloat data);
63  /**
64  * End of a GlGraph
65  */
66  virtual void endGlGraph();
67  /**
68  * Record a new Node
69  */
70  virtual void beginNode(GLfloat data);
71  /**
72  * End of a Node
73  */
74  virtual void endNode();
75  /**
76  * Record a new Edge
77  */
78  virtual void beginEdge(GLfloat data);
79  /**
80  * End of a Edge
81  */
82  virtual void endEdge();
83  /**
84  * Record a new pointToken
85  */
86  virtual void pointToken(GLfloat *data);
87  /**
88  * Record a new lineToken
89  */
90  virtual void lineToken(GLfloat *data);
91  /**
92  * Record a new lineResetToken
93  */
94  virtual void lineResetToken(GLfloat *data);
95  /**
96  * Record a new polygonToken
97  */
98  virtual void polygonToken(GLfloat *data);
99  /**
100  * End of the EPS document
101  */
102  virtual void end();
103 
104  /**
105  * Put in str the built EPS document
106  */
107  virtual void getResult(std::string* str);
108 
109 private:
110 
111  std::stringstream stream_out;
112 
113  GLfloat pointSize;
114 
115  Color fillColor;
116  Color strokeColor;
117  Color textColor;
118 
119 };
120 
121 }
122 
123 #endif // DOXYGEN_NOTFOR_DEVEL
124 
125 #endif // Tulip_GLEPSFEEDBACKBUILDER_H
126 ///@endcond