Rev Author Line No. Line
178 kaklik 1 #include "crossWidget.hh"
2  
3 using namespace mimas;
4  
5 CrossWidget::CrossWidget( QWidget *parent, Qt::WFlags f ):
6 VideoWidget( parent, f ), hasPoint(false), pointX( 0 ), pointY( 0 )
7 {
8 }
9  
10 void CrossWidget::setCross( const Vector &v )
11 {
12 hasPoint = true;
13 pointX = (int)v[0];
14 pointY = (int)v[1];
15 update();
16 }
17  
18 void CrossWidget::clearCross(void)
19 {
20 hasPoint = false;
21 update();
22 }
23  
24 void CrossWidget::paintGL(void)
25 {
26 VideoWidget::paintGL();
27 if ( hasPoint ) {
28 glColor3ub( 255, 0, 0 );
29 glPushMatrix();
30 glScalef( zoom, zoom, 1.0 );
31 glTranslatef( pointX, pointY, 0 );
32 glBegin( GL_LINES );
33 glVertex2i( -5, -5 );
34 glVertex2i( +5, +5 );
35 glVertex2i( -5, +5 );
36 glVertex2i( +5, -5 );
37 glEnd();
38 glPopMatrix();
39 };
40 };
41