9 #include "hippoconfig.h"
12 #include "msdevstudio/MSconfig.h"
34 using namespace hippodraw;
58 plotter -> addObserver (
this );
68 const std::vector< double > & y,
70 const Color & color ,
float)
73 std::cout <<
" debug : drawLines " << std::endl;
76 float r = (float)(color.
getRed() / 255.0);
77 float g = (float)(color.
getGreen() / 255.0);
78 float b = (float)(color.
getBlue() / 255.0);
83 std::cout <<
"debug : drawLines : color "
104 for (
unsigned int i = 0; i < x.size(); i = i+2 ) {
110 std::cout <<
"debug : " << x[i] <<
" " << y[i] << std::endl;
111 std::cout <<
"debug : " << x[i+1] <<
" " << y[i+1] << std::endl;
119 const std::vector< double > & y,
121 const std::vector< Color > & colors,
125 std::cout <<
"hippodraw::OpenGLView::drawColorLines :" << std::endl;
128 for (
unsigned int i = 0; i < x.size(); i+=2 ){
130 const Color & color = colors[i];
131 float r = color.
getRed () / 255.0;
132 float g = color.
getGreen () / 255.0;
133 float b = color.
getBlue () / 255.0;
161 const std::vector< double > & x
162 ,
const std::vector< double > & y
169 std::cout <<
" debug : drawViewLines" << std::endl;
186 for (
unsigned int i = 0; i < x.size(); i = i+2 ) {
188 glVertex3f (
toX(x[i]),
toY(y[i]),0 );
189 glVertex3f (
toX(x[i+1]),
toY(y[i+1]),0 );
197 const std::vector< double > & y,
199 const Color & color,
float)
202 std::cout <<
" debug : drawViewLines 2" << std::endl;
205 float r = (float)(color.
getRed() / 255.0);
206 float g = (float)(color.
getGreen() / 255.0);
207 float b = (float)(color.
getBlue() / 255.0);
224 for (
unsigned int i = 0; i < x.size(); i = i+2 ) {
226 glVertex3d (
toX(x[i]),
toY(y[i]),0 );
227 glVertex3d (
toX(x[i+1]),
toY(y[i+1]),0 );
233 const std::vector< double > & ypoints,
235 const Color & color,
float)
238 std::cout <<
" debug : drawPolyLine" << std::endl;
241 float r = (float)(color.
getRed() / 255.0);
242 float g = (float)(color.
getGreen() / 255.0);
243 float b = (float)(color.
getBlue() / 255.0);
260 glBegin (GL_LINE_STRIP);
261 for (
unsigned int i = 0; i < xpoints.size(); i++ ) {
271 int red,
int green,
int blue )
274 std::cout <<
" debug : drawSquare " << std::endl;
277 float r = (float)(red / 255.0);
278 float g = (float)(green / 255.0);
279 float b = (float)(blue / 255.0);
292 int red,
int green,
int blue ){
294 std::cout <<
"hippodraw::OpenGLView::drawViewSquare : " << std::endl;
297 float r = (float)(red / 255.0);
298 float g = (float)(green / 255.0);
299 float b = (float)(blue / 255.0);
304 glVertex3f(
toX(x1),
toY(y1),0);
305 glVertex3f(
toX(x2),
toY(y1),0);
306 glVertex3f(
toX(x2),
toY(y2),0);
307 glVertex3f(
toX(x1),
toY(y2),0);
313 const std::vector<double> & y,
316 const Color & color )
319 std::cout <<
" debug : drawPoints " << std::endl;
324 float r = (float)(color.
getRed() / 255.0);
325 float g = (float)(color.
getGreen() / 255.0);
326 float b = (float)(color.
getBlue() / 255.0);
332 for (
unsigned int i = 0; i < x.size(); i++) {
335 glBegin(GL_LINE_STRIP);
336 glVertex3f(
toViewX(x[i])-(sym_size/2),
toViewY(y[i])-(sym_size/2),0);
337 glVertex3f(
toViewX(x[i])+(sym_size/2),
toViewY(y[i])-(sym_size/2),0);
338 glVertex3f(
toViewX(x[i])+(sym_size/2),
toViewY(y[i])+(sym_size/2),0);
339 glVertex3f(
toViewX(x[i])-(sym_size/2),
toViewY(y[i])+(sym_size/2),0);
340 glVertex3f(
toViewX(x[i])-(sym_size/2),
toViewY(y[i])-(sym_size/2),0);
345 glVertex3f(
toViewX(x[i])-(sym_size/2),
toViewY(y[i])-(sym_size/2),0);
346 glVertex3f(
toViewX(x[i])+(sym_size/2),
toViewY(y[i])-(sym_size/2),0);
347 glVertex3f(
toViewX(x[i])+(sym_size/2),
toViewY(y[i])+(sym_size/2),0);
348 glVertex3f(
toViewX(x[i])-(sym_size/2),
toViewY(y[i])+(sym_size/2),0);
352 glBegin(GL_LINE_STRIP);
353 glVertex3f(
toViewX(x[i])-(sym_size/2),
toViewY(y[i])-(sym_size/2),0);
354 glVertex3f(
toViewX(x[i])+(sym_size/2),
toViewY(y[i])-(sym_size/2),0);
356 glVertex3f(
toViewX(x[i])-(sym_size/2),
toViewY(y[i])-(sym_size/2),0);
361 glVertex3f(
toViewX(x[i])-(sym_size/2),
toViewY(y[i])-(sym_size/2),0);
362 glVertex3f(
toViewX(x[i])+(sym_size/2),
toViewY(y[i])-(sym_size/2),0);
368 std::cout <<
" debug : drawPoints : circle : dummy." << std::endl;
369 glBegin(GL_LINE_STRIP);
390 glVertex3f(
toViewX(x[i])-(sym_size/2),
toViewY(y[i])-(sym_size/2),0);
391 glVertex3f(
toViewX(x[i])+(sym_size/2),
toViewY(y[i])+(sym_size/2),0);
392 glVertex3f(
toViewX(x[i])+(sym_size/2),
toViewY(y[i])-(sym_size/2),0);
393 glVertex3f(
toViewX(x[i])-(sym_size/2),
toViewY(y[i])+(sym_size/2),0);
403 const std::vector< double > &
404 ,
const std::vector< double > &
405 ,
const std::vector< Color > &
411 std::cout <<
" debug : drawPoints 2" << std::endl;
413 std::cout <<
" debug : drawPoints 2 : dummy" << std::endl;
503 #ifdef SSTREAM_DEFECT
506 std::ostringstream ost;
509 ost << mag << std::ends;
510 const std::string s(ost.str());
512 std::cout <<
" debug : drawMag " << s
513 <<
" x " << x <<
" y " << y
514 <<
" fontsize " << fontsize
531 draw_Text ( std::string(
"x10"),
toX(x),
toY(y), fontsize, 0,
'l',
't' );
533 draw_Text ( s,
toX(x+2*fontsize),
toY(y+fontsize*0.2), fontsize, 0,
'l',
't' );
547 float fontsize,
float angle,
548 char xp,
char yp ,
bool)
551 std::cout <<
" debug : drawText " << s << std::endl;
557 float fontsize,
float angle,
558 char xp,
char yp,
bool,
560 const Color * color )
563 std::cout <<
" debug : drawText2 " << s << std::endl;
604 std::cout <<
"hippodraw::OpenGLView::setDrawRect : dummy " << std::endl;
623 std::cout <<
" debug : draw_Text \"" << s
626 <<
" fontsize " << fontsize
627 <<
" angle " << angle
633 std::cout <<
" debug : draw_Text \"" << font->
family()
634 <<
"\" : pointSize " << font->
pointSize()
637 glRasterPos2f(x+12,y);
679 float pointSize = fontsize * 0.8;
702 float s1 = 2 * m_boundingRect.
getY() + m_boundingRect.getHeight();
723 return static_cast <
float > ( dx );
728 return static_cast <
float > ( dy );