Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / API_Bilat_Graph2D / INC / model / Graph.h
1 #ifndef GRAPH_H_
2 #define GRAPH_H_
3 #include "envGraph.h"
4 #include "GridApparance.h"
5 #include "Figure.h"
6 #include "GraphObserver_I.h"
7
8 #include <vector>
9 using std::vector;
10
11 #include <mutex>
12 //#include <boost/thread/mutex.hpp>
13 using std::mutex;
14
15 /*----------------------------------------------------------------------*\
16 |* Declaration *|
17 \*---------------------------------------------------------------------*/
18
19 /*--------------------------------------*\
20 |* Public *|
21 \*-------------------------------------*/
22
23 class CBI_GRAPH Graph
24 {
25 public:
26 /*--------------------------------------*\
27 |* Constructor *|
28 \*-------------------------------------*/
29
30 Graph(Title title, Domaine domaine, Apparance apparance);
31
32 /**
33 * L'intervalY du domaine du graph est calcul� automatiquement.
34 */
35 Graph(Title title, Interval intervalX, Apparance apparance);
36
37 Graph(Title title);
38
39 /**
40 * Graph with title fontType TIMES_ROMAN_24
41 */
42 Graph(string title);
43
44 Graph();
45
46 private:
47
48 Graph(const Graph& src);
49
50 /*--------------------------------------*\
51 |* Destructor *|
52 \*-------------------------------------*/
53
54 public:
55 virtual ~Graph();
56
57 /*--------------------------------------*\
58 |* Methodes *|
59 \*-------------------------------------*/
60
61 public:
62
63 void add(Figure* ptrFigure);
64
65 void remove(Figure* ptrFigure);
66
67 void attach(GraphObserver_I* observer);
68
69 void detach(GraphObserver_I* observer);
70
71 void notifyAddFigure(Figure* ptrFigure);
72
73 void notifyRemoveFigure(Figure* ptrFigure);
74
75 void update();
76 /**
77 * return true if need repaint
78 */
79 virtual bool animationStep();
80
81 private :
82
83 void computeDomaine();
84
85 /*--------------------------------------*\
86 |* Get *|
87 \*-------------------------------------*/
88
89 public :
90
91 /*
92 * getistFigures fourni une copie du vector de figure
93 */
94 vector<Figure*> getListFigures() const;
95
96 Figure* getFigure(int i);
97
98 GridApparance* getGridApparance() const;
99
100 Apparance* getApparance() const;
101
102 Title* getTitle() const;
103
104 Domaine* getDomaine() const;
105
106 int getFigureSize() const;
107
108 /*--------------------------------------*\
109 |* Set *|
110 \*-------------------------------------*/
111
112 void setApparance(Apparance apparance);
113
114 /**
115 * set Title with fontType TIMES_ROMAN_24
116 */
117 void setTitle(string title);
118
119 void setTitle(Title title);
120
121 void setDomaine(Domaine domaine);
122
123 void setIntervalX(Interval intervalX);
124
125 void setGridApparance(GridApparance gridApparance);
126
127 /*--------------------------------------*\
128 |* Attributs *|
129 \*-------------------------------------*/
130
131 private:
132
133 // Inputs
134 Title* title;
135 Domaine* domaine;
136 Apparance* apparance;
137 bool isIntervalYAuto;
138
139 // Tools
140 GridApparance* gridApparance;
141 vector<Figure*> listFigures;
142 vector<GraphObserver_I*> listObserver;
143 mutex mutexListObserver;
144 mutex mutexListFigures;
145 };
146
147 #endif
148
149 /*----------------------------------------------------------------------*\
150 |* End *|
151 \*---------------------------------------------------------------------*/