Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / API_Bilat_Image_GL / INC / common / ImageMOOs_I.h
1 #ifndef IMAGEMOOS_A_H
2 #define IMAGEMOOS_A_H
3
4 #include "envGLImage.h"
5 #include "KeyListener_I.h"
6 #include "MouseListener_I.h"
7 #include "ImageObserver_I.h"
8 #include "Graphic2Ds.h"
9
10 #include <iostream>
11 #include <string>
12 #include <vector>
13
14 using std::vector;
15 using std::string;
16 using std::ostream;
17
18 /*----------------------------------------------------------------------*\
19 |* Declaration *|
20 \*---------------------------------------------------------------------*/
21
22 /*--------------------------------------*\
23 |* Public *|
24 \*-------------------------------------*/
25
26 /**
27 * Base class for Image Model.
28 */
29 class CBI_GLIMAGE ImageMOOs_I
30 {
31
32 /*--------------------------------------*\
33 |* Constructor *|
34 \*-------------------------------------*/
35 public:
36 ImageMOOs_I(unsigned int width, unsigned int height);
37
38 ImageMOOs_I(const ImageMOOs_I &imageSource);
39
40 /*--------------------------------------*\
41 |* Destructor *|
42 \*-------------------------------------*/
43 public:
44 virtual ~ImageMOOs_I();
45
46 /*--------------------------------------*\
47 |* Methodes *|
48 \*-------------------------------------*/
49 public:
50 /**
51 * A redefinir par l'utilisateur
52 */
53 virtual void animationStep(bool& isNeedUpdateView)=0;
54
55 /**
56 * A redefinir par l'utilisateur
57 */
58 virtual void paintPrimitives(Graphic2Ds& ptrGraphic2D)=0;
59
60 /**
61 * call by API
62 */
63 virtual void animationStepAPI(bool& isNeedUpdateView);
64
65 /**
66 * call by API
67 */
68 virtual void paintPrimitivesAPI(Graphic2Ds& ptrGraphic2D);
69
70 virtual void print(ostream& stream) const;
71
72 void registerImageObserver(ImageObserver_I &ptrObserver);
73
74 void unregisterImageObserver(ImageObserver_I &ptrObserver);
75
76 /*
77 * Notify all registred ImageObserver_I
78 * @see registerImageObserver
79 */
80 void update() const;
81
82 /*--------------------------------------*\
83 |* Set *|
84 \*-------------------------------------*/
85 public:
86
87 void setKeyListener(KeyListener_I* ptrKeyListener);
88
89 void setMouseListener(MouseListener_I* ptrMouseListener);
90
91 /*--------------------------------------*\
92 |* Get *|
93 \*-------------------------------------*/
94
95 public:
96
97 inline unsigned int getW() const
98 {
99 return width;
100 }
101
102 inline unsigned int getH() const
103 {
104 return height;
105 }
106
107 inline KeyListener_I* getKeyListener() const
108 {
109 return ptrKeyListener;
110 }
111
112 inline MouseListener_I* getMouseListener() const
113 {
114 return ptrMouseListener;
115 }
116
117 unsigned int getSizeOctet() const;
118
119 /*--------------------------------------*\
120 |* Friend *|
121 \*-------------------------------------*/
122
123 /**
124 * call image.print(stream)
125 */
126 CBI_GLIMAGE
127 friend ostream& operator<<(ostream& stream, const ImageMOOs_I& image);
128
129 /*--------------------------------------*\
130 |* Attributs *|
131 \*-------------------------------------*/
132
133 private:
134 // Inputs
135 unsigned int width;
136 unsigned int height;
137
138 // Tools
139 KeyListener_I* ptrKeyListener;
140 MouseListener_I* ptrMouseListener;
141 vector<ImageObserver_I*> vectorObservable;
142
143 };
144
145 #endif
146
147 /*----------------------------------------------------------------------*\
148 |* End *|
149 \*---------------------------------------------------------------------*/