4 #include "Displayable_A.h"
6 #include "GraphObserver_I.h"
7 #include "FigureVisitor.h"
9 #include "CurveParametric.h"
10 #include "CurveAnalytic.h"
13 #include "GLGraphRunnable.h"
23 //#include <boost/thread/mutex.hpp>
24 //#include <boost/atomic.hpp>
29 /*----------------------------------------------------------------------*\
31 \*---------------------------------------------------------------------*/
33 /*--------------------------------------*\
35 \*-------------------------------------*/
37 class CBI_GRAPH GLGraph
: public GraphObserver_I
, public Displayable_A
, public FigureVisitor_I
40 GLGraph(Graph
* ptrGraph
);
44 /*--------------------------------------*\
46 \*-------------------------------------*/
51 void init(Panel_A
&panel
);
56 void reshape(Panel_A
&panel
, int w
, int h
);
61 void display(Panel_A
&panel
);
66 void release(Panel_A
&panel
);
71 void onFigureAdd(Figure
* ptrFigure
);
76 void onFigureRemove(Figure
* ptrFigure
);
85 * visit create the right GLPolylines
87 virtual void visit(CurveParametric
* ptrPolylines
);
91 * visit create the right GLCurve
93 virtual void visit(CurveAnalytic
* ptrCurve
);
96 void computeViewports(Panel_A
&panel
);
98 int computeTitleHeight(Panel_A
&panel
);
100 void drawGraph(Panel_A
&panel
);
102 void drawTitle(Panel_A
&panel
);
104 void drawLegend(Panel_A
&panel
);
106 void drawGraphCadre(Panel_A
&panel
);
108 void drawGraphGrid(Panel_A
&panel
);
110 void processQueue(Panel_A
&panel
);
112 void updateGL(Panel_A
&panel
);
114 const Font_A
* loadFont(FontLoader_A
* ptrFontLoader
, Title
* ptrTitle
);
116 /*--------------------------------------*\
118 \*-------------------------------------*/
122 Viewport
getPanelViewport() const;
124 Viewport
getGraphViewport() const;
126 Viewport
getTitleViewport() const;
128 Graph
* getGraph() const;
130 /*--------------------------------------*\
132 \*-------------------------------------*/
139 atomic
<bool> isNeedUpdate
;
140 map
<Figure
*, GLFigure
*> mapFigureGL
;
141 queue
<GLGraphRunnable
*> queueGLGraphRunnable
;
142 Viewport viewportPanel
; //in pixel
143 Viewport viewportGraph
; //in pixel
144 Viewport viewportTitle
; //in pixel
148 mutex mutexMapFigure
;
150 static const int LEFT_MARGIN
;
151 static const int RIGHT_MARGIN
;
152 static const int TOP_MARGIN
;
153 static const int BOTTOM_MARGIN
;
154 static const int GRAPH_MARGIN
;
155 static const float TITLE_V_SPACING
;
160 /*----------------------------------------------------------------------*\
162 \*---------------------------------------------------------------------*/