899519f7926d1f645fce1f02b358af12a1cc4ae4
5 #include "ImageFonctionel.h"
6 #include "StringTools.h"
12 /*----------------------------------------------------------------------*\
14 \*---------------------------------------------------------------------*/
16 /*--------------------------------------*\
18 \*-------------------------------------*/
20 /*--------------------------------------*\
22 \*-------------------------------------*/
24 /*--------------------------------------*\
26 \*-------------------------------------*/
28 /*----------------------------------------------------------------------*\
30 \*---------------------------------------------------------------------*/
32 /*--------------------------------------*\
34 \*-------------------------------------*/
36 ImageFonctionel::ImageFonctionel(AnimableFonctionel_I
* ptrAnimable
, ColorRGB_01
* ptrColorTitreRGB
) :
37 ImageFonctionelMOOs_A(
40 *ptrAnimable
->getDomaineMathInit()
43 this->ptrAnimable
= ptrAnimable
;
44 this->ptrColorTitreRGB
= ptrColorTitreRGB
;
45 this->valueNames
= ptrAnimable
->getNames();
46 this->values
= new float[this->valueNames
.size()];
48 setEnableDomaineOverlay(true);
51 ImageFonctionel::~ImageFonctionel(void)
53 delete this->ptrAnimable
;
54 delete[] this->values
;
60 void ImageFonctionel::animationStep(bool& isNeedUpdateView
)
62 // cout << "[CBI] : Image : animationStep" <<endl;
64 ptrAnimable
->animationStep();
65 isNeedUpdateView
= true; // true par default
71 void ImageFonctionel::fillImageGL(uchar4
* ptrDevImageGL
, int w
, int h
, const DomaineMath
& domaineMath
) // override
73 // cout << "[CBI] : Image : fillImageGL" <<endl;
75 ptrAnimable
->runGPU(ptrDevImageGL
, domaineMath
);
81 void ImageFonctionel::paintPrimitives(Graphic2Ds
& graphic2D
) // redefinition
83 const Font_A
* ptrfont
= graphic2D
.getFont(TIMES_ROMAN_24
);
85 float r
= ptrColorTitreRGB
->r
;
86 float g
= ptrColorTitreRGB
->g
;
87 float b
= ptrColorTitreRGB
->b
;
88 graphic2D
.setColorRGB(r
, g
, b
);
93 this->ptrAnimable
->getValues(this->values
);
94 for (int i
= 0; i
< this->valueNames
.size(); i
++)
98 title
+= this->valueNames
[i
];
99 title
+= StringTools::toString(this->values
[i
]);
101 graphic2D
.drawTitleTop(title
, ptrfont
);
106 string title
= ptrAnimable
->getTitle();
107 graphic2D
.drawTitleBottom(title
, ptrfont
);
111 /*--------------------------------------*\
113 \*-------------------------------------*/
115 /*----------------------------------------------------------------------*\
117 \*---------------------------------------------------------------------*/