void tui::StatusLine::update_coords(const TP& cp)
{
   _cp = cp;
   glColor4f(0,0,0,1);
   glRecti(_Xcoord.p1().x(), _Xcoord.p1().y(), _Xcoord.p2().x(), _Xcoord.p2().y());
   glRecti(_Ycoord.p1().x(), _Ycoord.p1().y(), _Ycoord.p2().x(), _Ycoord.p2().y());

//   glScissor( _Xcoord.p1().x(), _Xcoord.p1().y(), _Xcoord.p2().x() - _Xcoord.p1().x(), _Xcoord.p2().y() - _Xcoord.p1().y() );
//   glEnable(GL_SCISSOR_TEST);
//   
   glColor4f(0,1,1,1);

   wxString wsX;
   wsX.sprintf(wxT("%6d"),_cp.x());
   wxString wsY;
   wsY.sprintf(wxT("%6d"),_cp.y());

//
//   glClear(GL_COLOR_BUFFER_BIT);
 //  
   glPushMatrix();
   glTranslatef(_wcX.x(), _wcX.y(), 0);
   glScalef(_scaledpix, _scaledpix, 1);
   glfDrawSolidString(wsX.mb_str());
   glPopMatrix();
   
   glPushMatrix();
   glTranslatef(_wcY.x(), _wcY.y(), 0);
   glScalef(_scaledpix, _scaledpix, 1);
   glfDrawSolidString(wsY.mb_str());
   glPopMatrix();
//   glDisable(GL_SCISSOR_TEST);
   
}
void tui::StatusLine::draw()
{
   glColor4f((GLfloat)1,(GLfloat)1,(GLfloat)1,(GLfloat)0.7);
   glEnable(GL_POLYGON_SMOOTH);   //- for solid fill
   glDisable(GL_POLYGON_STIPPLE);   //- for solid fill
   glRecti(_sb_TR.x(), _sb_TR.y(), _sb_BL.x(), _sb_BL.y());

   glColor4f(0,0,0,1);
   glPushMatrix();
   glTranslatef(_cY.x(), _cY.y(), 0);
   glScalef(_scaledpix, _scaledpix, 1);
   glfDrawSolidString("Y:");
   glPopMatrix();
   
   glPushMatrix();
   glTranslatef(_cX.x(), _cX.y(), 0);
   glScalef(_scaledpix, _scaledpix, 1);
   glfDrawSolidString("X:");
   glPopMatrix();

   glPushMatrix();
   glTranslatef(_dY.x(), _dY.y(), 0);
   glScalef(_scaledpix, _scaledpix, 1);
   glfDrawSolidString("dX:");
   glPopMatrix();
   
   glPushMatrix();
   glTranslatef(_dX.x(), _dX.y(), 0);
   glScalef(_scaledpix, _scaledpix, 1);
   glfDrawSolidString("dX:");
   glPopMatrix();
   
   update_coords(_cp);
}
Esempio n. 3
0
//-----------------------------------------------------------------------------
// display graph info boxes
void MapCodegenState::graphinfo_display(graph_t *pGraph)
{
        float height;                                                           // height of text
        float width;                                                            // width of text
        float xmin,ymin,xmax,ymax;      // font dimension
        float scale = 0.04;                                     // font scale

        char *text = pGraph->name;
        glfGetStringBounds( text,&xmin,&ymin,&xmax,&ymax);
        width  = (xmax-xmin)*scale+0.025;
        height = (ymax-ymin)*scale+0.025;
        //width = height = 0.3;
        
        //box bound;
        pointf LL, UR;
        giOffsetX = -orthoX+ giOffset;
        giOffsetY =  orthoY-( giOffset +height);
        LL.x = 0.0;
        LL.y = 0.0;
        UR.x = LL.x+ width;
        UR.y = LL.y+ height;
        
        glColor4f( 0,0, 0.25 , 0.75*gFade);
        glBegin(GL_QUADS);
        //bound = pGraph->u.bb;
        glVertex3f( GIX(LL.x),GIY(LL.y), zpos );
        glVertex3f( GIX(UR.x),GIY(LL.y), zpos );
        glVertex3f( GIX(UR.x),GIY(UR.y), zpos );
        glVertex3f( GIX(LL.x),GIY(UR.y), zpos );
        glEnd();

        glColor4f( 0.0,0.0,0.0, 0.5*gFade);
        glBegin(GL_LINES);
        glVertex3f( GIX(LL.x),GIY(LL.y), zpos );
        glVertex3f( GIX(UR.x),GIY(LL.y), zpos );
        glVertex3f( GIX(UR.x),GIY(UR.y), zpos );
        glVertex3f( GIX(LL.x),GIY(UR.y), zpos );
        glVertex3f( GIX(LL.x),GIY(UR.y), zpos );
        glEnd();

        float tpx = 0.0 - (scale*xmin);
        float tpy = 0.0 - (scale*ymin);
        tpx += scale*1.0;

        glPushMatrix();
        glTranslatef( GIX(tpx), GIY(tpy), zpos );
        glScalef( scale,scale,scale );

        glColor4f( 0.0, 1.0, 0.0, 0.9*gFade);
        glfDrawSolidString( text );
        glPopMatrix();
}
Esempio n. 4
0
void layprop::SDLine::draw(const DBline& long_mark, const DBline& short_mark, const DBline& text_bp, const double scaledpix, const real _step) const
{
   // calculate the nonius ticks
   LineList noni_list;
   nonius(short_mark, long_mark, _step, noni_list);

   glColor4f(1, 1, 1, 0.7); // gray
   glDisable(GL_POLYGON_STIPPLE);
//   glEnable(GL_POLYGON_SMOOTH);   //- for solid fill
   glBegin(GL_LINES);glLineWidth(2);
   // draw the nonius ...
   for (LineList::const_iterator CL = noni_list.begin(); CL != noni_list.end(); CL++)
   {
      glVertex2i(CL->p1().x(),CL->p1().y()); 
      glVertex2i(CL->p2().x(),CL->p2().y());
   }
   // ... and the ruler itself
   glVertex2i(_ln.p1().x(), _ln.p1().y());
   glVertex2i(_ln.p2().x(), _ln.p2().y());
   glEnd();
   glLineWidth(1);

   CTM tmtrx;
   tmtrx.Rotate(_angle);
   tmtrx.Translate(_center.x(), _center.y());
   DBline central_elevation = text_bp * tmtrx;

   glPushMatrix();
   glTranslatef(central_elevation.p2().x(), central_elevation.p2().y(), 0);
   glScalef(scaledpix, scaledpix, 1);
   glRotatef(_angle, 0, 0, 1);
   
   glfDrawSolidString(_value.c_str());

   glDisable(GL_POLYGON_SMOOTH); //- for solid fill
   glEnable(GL_POLYGON_STIPPLE);
   glPopMatrix();

}