Пример #1
0
int			main(void)
{
	Form			paper("Piece of paper", 150, 150);
	Bureaucrat		barneyStinson("Barney Stinson", 2);

	std::cout << "Printing \"paper(\"Piece of paper\", 150, 150);\": " << paper;
	barneyStinson.signForm(paper);
	std::cout << "Printing \"paper(\"Piece of paper\", 150, 150);\": " << paper;

	Form			law("Law", 1, 1);
	std::cout << "Printing \"paper(\"Law\", 1, 1);\": " << law;
	barneyStinson.signForm(law);
	std::cout << "Printing \"paper(\"Law\", 1, 1);\": " << law;

	try {
		std::cout << "Trying to create \"something(\"something\", 151, 151);\"" << std::endl;
		Form			something("something", 151, 151);
	} catch (Form::GradeTooLowException & e) {
		std::cout << "Exception: " << e.what() << std::endl;
	}

	try {
		std::cout << "Trying to create \"something(\"something\", 0, 0);\"" << std::endl;
		Form			something("something", 0, 0);
	} catch (Form::GradeTooHighException & e) {
		std::cout << "Exception: " << e.what() << std::endl;
	}
}
Пример #2
0
QodeEditor::QodeEditor( QWidget* parent )
    : CodeEditor( parent )
{
    setCaretLineBackground( QColor( 150, 150, 150, 150 ) );

    MarginStacker* margins = new MarginStacker( this );
    margins->setVisible( QodeEdit::BookmarkMargin, true );
    margins->setVisible( QodeEdit::NumberMargin, true );
    margins->setVisible( QodeEdit::RevisionMargin, true );
    margins->setVisible( QodeEdit::FoldMargin, true );
    margins->setVisible( QodeEdit::SpaceMargin, true );

    setCaretLineBackground(paper());

    // fake save document shortcut
    new QShortcut( QKeySequence::Save, this, SLOT( save() ) );

    new QShortcut( QKeySequence("Ctrl+Shift+D"), this, SLOT(duplicateLine()) );

    new QShortcut( QKeySequence("Ctrl+Shift+Up"), this, SLOT(swapLineUp()) );
    new QShortcut( QKeySequence("Ctrl+Shift+Down"), this, SLOT(swapLineDown()) );

    new QShortcut( QKeySequence("Ctrl+]"), this, SLOT(indent()) );
    new QShortcut( QKeySequence("Ctrl+["), this, SLOT(unindent()) );

    new QShortcut( QKeySequence("Ctrl+J"), this, SLOT(joinLines()) );

    new QShortcut( QKeySequence("Ctrl+Shift+L"), this, SLOT(expandSelectionToLine()) );
    new QShortcut( QKeySequence("Ctrl+Shift+W"), this, SLOT(expandSelectionToWord()) );
}
Пример #3
0
int main( int argc, char ** argv ) {
	for ( int i = 0; i < 3; ++i ){
		computersThrow = computerThrow();
		printf( "Your Score: %d\n", yourScore );
		puts( "1. Rock" );
		puts( "2. Paper" );
		puts( "3. Scissors" );
		printf( "%d: What do you want to throw? ", i );
		fflush(stdout);
		fgets( response, max_length, stdin );
		val = atoi( response );
		if( val == 1 ){
			rock();
		} else if( val == 2 ){
			paper();
		} else if( val == 3){
			scissors();
		} else {
			puts( "Enter valid choice 1, 2 or 3" );
			i -= 1;
		}
	}


	end_game();
	return 0;
}
Пример #4
0
// Refresh the style.
void QsciStyle::refresh()
{
    setColor(color());
    setPaper(paper());
    setFont(font());
    setEolFill(eolFill());
    setTextCase(textCase());
    setVisible(visible());
    setChangeable(changeable());
    setHotspot(hotspot());
}
Пример #5
0
int main(int argc, char* argv[])
{
    stk::rectangle paper(0,0,2400,3300);
    stk::logger::get()->add_target(&std::cout, stk::LL_Info);
    
    stk::surface_bitmap::ptr test=stk::surface_bitmap::create(paper);
    stk::graphics_context::ptr gc=stk::graphics_context::create();
    gc->fill_color(0xfffffffa);
    gc->line_color(0x000000fa);
    stk::font_properties properties("Vera.ttf",60);
    properties.height=100;
    gc->font(stk::font_manager::get()->get_font(properties));
    test->gc(gc);
    test->fill_rect(paper);
    test->draw_line(0,0,1000,1000);
    test->draw_line(0,1000,1000,1000);
    test->draw_text(stk::rectangle(20,20,1000,1000),L"Test",0);

    print(paper,test->get_bitmap());
}
Пример #6
0
void SqlEditorWidget::prefsChanged()
{
    QFont baseFont(m_prefs->sqlFont());
    baseFont.setPointSize(m_prefs->sqlFontSize());

    lexer()->setFont(baseFont);
    setFont(baseFont);

    // syntax highlighting
    lexer()->setColor(m_prefs->syDefaultColor(), QsciLexerSQL::Default);
    lexer()->setColor(m_prefs->syKeywordColor(), QsciLexerSQL::Keyword);
    QFont defFont(lexer()->font(QsciLexerSQL::Keyword));
    defFont.setBold(true);
    lexer()->setFont(defFont, QsciLexerSQL::Keyword);
    lexer()->setColor(m_prefs->syNumberColor(), QsciLexerSQL::Number);
    lexer()->setColor(m_prefs->syStringColor(), QsciLexerSQL::SingleQuotedString);
    lexer()->setColor(m_prefs->syStringColor(), QsciLexerSQL::DoubleQuotedString);
    lexer()->setColor(m_prefs->syCommentColor(), QsciLexerSQL::Comment);
    lexer()->setColor(m_prefs->syCommentColor(), QsciLexerSQL::CommentLine);
    lexer()->setColor(m_prefs->syCommentColor(), QsciLexerSQL::CommentDoc);

    setAutoCompletionThreshold(m_prefs->codeCompletion() ?
                               m_prefs->codeCompletionLength() : -1
                              );

    if (m_prefs->textWidthMark())
    {
        setEdgeColumn(m_prefs->textWidthMarkSize());
        setEdgeColor(Qt::gray);
        setEdgeMode(QsciScintilla::EdgeLine);
    }
    else
        setEdgeMode(QsciScintilla::EdgeNone);

    setMarkerBackgroundColor(m_prefs->activeHighlighting() ?
                             m_prefs->activeHighlightColor() : paper());
}
Пример #7
0
extern void aprstat_althist(maptool_pIMAGE * img, aprsdecode_pOPHIST op,
                char * test, float * way, unsigned long * beacons,
                unsigned long * msgs, unsigned long * acks,
                unsigned long * rejs)
{
   char h[256];
   char s[256];
   float maxalt;
   float minalt;
   float alt[5760];
   float hdiv;
   float wdiv;
   unsigned long markx1;
   unsigned long markx;
   unsigned long xc;
   unsigned long sc;
   unsigned long x;
   unsigned long Maxx;
   struct aprsdecode_DAT dat;
   float waysum;
   long markalt;
   size_t tmp[2];
   unsigned long tmp0;
   *way = 0.0f;
   *beacons = 0UL;
   *msgs = 0UL;
   *acks = 0UL;
   *rejs = 0UL;
   if (op==0 || op->frames==0) {
      *test = 0;
      return;
   }
   Maxx = dynmaxx(8UL, 400UL, 720UL);
   decodealt(way, beacons, wdiv, rejs, acks, msgs, &dat, alt, &waysum, op,
                &markalt, &markx1, &markx, 0);
   if (waysum<0.05f) {
      *test = 0; /* no altitudes or km */
      return;
   }
   if (*test) return;
   X2C_DYNALLOCATE((char **)img,sizeof(struct maptool_PIX),
                (tmp[0] = Maxx+16UL,tmp[1] = 136U,tmp),2u);
   useri_debugmem.screens += (*img)->Len1*(*img)->Size1;
   if (*img==0) {
      osi_WrStrLn("error image alloc", 18ul);
      return;
   }
   maptool_clr(*img);
   wdiv = X2C_DIVR((float)(Maxx*8UL-1UL),waysum);
   decodealt(way, beacons, wdiv, rejs, acks, msgs, &dat, alt, &waysum, op,
                &markalt, &markx1, &markx, 1);
   interpol(alt);
   norm(&hdiv, alt, &maxalt, &minalt);
   /*
   FOR x:=0 TO HIGH(alt) DO
    IF alt[x]>=0.0 THEN WrFixed(alt[x], 3,11) ELSE WrStr(".") END;
   END;
    WrStrLn("");
   */
   /*sc:=VAL(CARDINAL, maxalt-minalt) DIV sfact(FLOAT(maxalt-minalt)); */
   sc = sfact(maxalt-minalt);
   strncpy(s,"  ",256u);
   aprsstr_Append(s, 256ul, op->call, 9ul);
   aprsstr_Append(s, 256ul, " dist=", 7ul);
   aprsstr_FixToStr(waysum, 2UL, h, 256ul);
   aprsstr_Append(s, 256ul, h, 256ul);
   aprsstr_Append(s, 256ul, "km min=", 8ul);
   aprsstr_IntToStr((long)X2C_TRUNCI(minalt,X2C_min_longint,X2C_max_longint),
                 1UL, h, 256ul);
   aprsstr_Append(s, 256ul, h, 256ul);
   aprsstr_Append(s, 256ul, "m max=", 7ul);
   aprsstr_IntToStr((long)X2C_TRUNCI(maxalt,X2C_min_longint,X2C_max_longint),
                 1UL, h, 256ul);
   aprsstr_Append(s, 256ul, h, 256ul);
   if (markalt>X2C_min_longint) {
      aprsstr_Append(s, 256ul, "m curs=", 8ul);
      aprsstr_IntToStr(markalt, 1UL, h, 256ul);
      aprsstr_Append(s, 256ul, h, 256ul);
   }
   aprsstr_Append(s, 256ul, "m (NN)", 7ul);
   paper(img, minalt, maxalt, sc, 8UL, Maxx, 120UL, s, 256ul);
   tmp0 = Maxx+8UL;
   x = 5UL;
   if (x<=tmp0) for (;; x++) {
      setpix(*img, (long)x, 8L, 200L, 1000L, 200L);
      if (x==tmp0) break;
   } /* end for */
   strncpy(h,"km",256u);
   if (waysum<5.0f) {
      waysum = waysum*1000.0f;
      strncpy(h,"m",256u);
   }
   sc = sfact(waysum);
   hdiv = X2C_DIVR((float)sc*(float)Maxx,waysum);
   wdiv = 0.0f;
   xc = 0UL;
   do {
      for (x = 5UL; x<=7UL; x++) {
         setpix(*img, (long)(aprsdecode_trunc(wdiv)+8UL), (long)x, 200L,
                1000L, 200L);
      } /* end for */
      if (xc>0UL && aprsdecode_trunc(wdiv)<Maxx-10UL) {
         num(*img, (long)((aprsdecode_trunc(wdiv)+8UL)-6UL), 8L, (long)xc, h,
                 256ul);
         h[0U] = 0;
      }
      xc += sc;
      wdiv = wdiv+hdiv;
   } while (aprsdecode_trunc(wdiv)<=Maxx);
   if (markx>0UL) {
      for (x = 8UL; x<=128UL; x++) {
         setpix(*img, (long)(markx+8UL), (long)x, 50L, 400L, 500L);
      } /* end for */
   }
   tmp0 = Maxx*8UL-1UL;
   x = 0UL;
   if (x<=tmp0) for (;; x++) {
      /* draw graph */
      addpix(*img, (float)x*0.125f+8.0f, alt[x]+8.0f, 62UL, 62UL, 87UL);
      if (x==tmp0) break;
   } /* end for */
} /* end althist() */
Пример #8
0
extern void aprstat_wxgraph(maptool_pIMAGE * img, aprsdecode_pOPHIST op,
                unsigned long stime, unsigned short * what,
                struct aprstat_LASTVAL * lastval)
{
   aprsdecode_pFRAMEHIST fr;
   unsigned long Maxx;
   unsigned long step;
   unsigned long xt;
   unsigned long xi;
   float XStep;
   float yax1;
   float yax0;
   float vh;
   struct WX min0;
   struct WX max0;
   char hh[256];
   char h[256];
   char s[256];
   struct aprsdecode_DAT dat;
   float temp[1440];
   float hyg[1440];
   float baro[1440];
   float winds[1440];
   float windd[1440];
   float gust[1440];
   float rain1[1440];
   float rain24[1440];
   float rain0[1440];
   float lumi[1440];
   unsigned short have;
   char dirvalid;
   struct WX * anonym;
   if (op==0 || op->frames==0) {
      /*OR (op^.lastinftyp<100)*/
      return;
   }
   Maxx = dynmaxx(8UL, 320UL, 720UL);
   XStep = X2C_DIVR((float)Maxx,1440.0f);
   *img = 0;
   for (xi = 0UL; xi<=1439UL; xi++) {
      temp[xi] = (-1.E+4f);
      hyg[xi] = (-1.E+4f);
      baro[xi] = (-1.E+4f);
      winds[xi] = (-1.E+4f);
      windd[xi] = (-1.E+4f);
      gust[xi] = (-1.E+4f);
      rain1[xi] = (-1.E+4f);
      rain24[xi] = (-1.E+4f);
      rain0[xi] = (-1.E+4f);
      lumi[xi] = (-1.E+4f);
   } /* end for */
   { /* with */
      struct WX * anonym = &max0;
      anonym->temp = (-1.E+4f);
      anonym->hyg = (-1.E+4f);
      anonym->baro = (-1.E+4f);
      anonym->wind = (-1.E+4f);
      anonym->rain = (-1.E+4f);
      anonym->lumi = (-1.E+4f);
      anonym->siev = (-1.E+4f);
   }
   dirvalid = 0;
   min0.temp = X2C_max_real;
   min0.baro = X2C_max_real;
   memset((char *)lastval,(char)0,sizeof(struct aprstat_LASTVAL));
   fr = op->frames;
   do {
      if (((fr->time0>stime-86400UL && fr->time0<=stime)
                && aprsdecode_Decode(fr->vardat->raw, 500ul,
                &dat)>=0L) && dat.sym=='_') {
         xt = aprsdecode_trunc((float)(fr->time0-(stime-86400UL))
                *1.6666666666667E-2f);
         if (xt>=1440UL) xt = 1439UL;
         vh = X2C_DIVR(dat.wx.temp-32.0f,1.8f);
         if (vh>=(-99.0f) && vh<=99.0f) {
            temp[xt] = vh;
            if (vh>max0.temp) max0.temp = vh;
            if (vh<min0.temp) min0.temp = vh;
            lastval->temp = vh;
         }
         if (dat.wx.hygro>=0.0f && dat.wx.hygro<=100.0f) {
            hyg[xt] = dat.wx.hygro;
            if (dat.wx.hygro>max0.hyg) max0.hyg = dat.wx.hygro;
            lastval->hyg = dat.wx.hygro;
         }
         vh = dat.wx.baro*0.1f;
         if (vh>=900.0f && vh<=1100.0f) {
            baro[xt] = vh;
            if (vh>max0.baro) max0.baro = vh;
            if (vh<min0.baro) min0.baro = vh;
            lastval->baro = vh;
         }
         vh = dat.wx.rain24*0.254f;
         if (vh>=0.0f && vh<300.0f) {
            rain24[xt] = vh;
            if (vh>max0.rain) max0.rain = vh;
            lastval->rain24 = vh;
         }
         vh = dat.wx.raintoday*0.254f;
         if (vh>=0.0f && vh<300.0f) {
            rain0[xt] = vh;
            if (vh>max0.rain) max0.rain = vh;
         }
         vh = dat.wx.rain1*0.254f;
         if (vh>=0.0f && vh<300.0f) {
            rain1[xt] = vh;
            if (vh>max0.rain) max0.rain = vh;
            lastval->rain = vh;
         }
         if (dat.wx.lum>=0.0f && dat.wx.lum<=2000.0f) {
            lumi[xt] = dat.wx.lum;
            if (dat.wx.lum>max0.lumi) max0.lumi = dat.wx.lum;
            lastval->lumi = dat.wx.lum;
         }
         if (dat.wx.sievert>=0.0f && dat.wx.sievert<1000.0f) {
            /*        siev[xt]:=dat.wx.sievert; */
            if (dat.wx.sievert>max0.siev) max0.siev = dat.wx.sievert;
            lastval->siev = dat.wx.sievert;
         }
         if (dat.course>0UL && dat.course<=360UL) {
            lastval->winddir = (float)(dat.course%360UL);
            windd[xt] = lastval->winddir;
            dirvalid = 1;
         }
         vh = (float)dat.speed*1.609f;
         if (vh>=0.0f && vh<=1000.0f) {
            winds[xt] = vh;
            lastval->winds = vh;
            if (vh>max0.wind) max0.wind = vh;
         }
         vh = dat.wx.gust*1.609f;
         if (vh>=0.0f && vh<=1000.0f) {
            gust[xt] = vh;
            lastval->gust = vh;
            if (vh>max0.wind) max0.wind = vh;
         }
      }
      fr = fr->next;
   } while (fr);
   aprstext_DateLocToStr(stime, h, 256ul);
   aprsstr_Append(h, 256ul, " ", 2ul);
   aprsstr_Append(h, 256ul, op->call, 9ul);
   have = 0U;
   if (max0.temp!=(-1.E+4f)) {
      have |= 0x1U;
      if ((0x1U & *what)) {
         if (!newimg(Maxx, img)) return;
         scale(temp, 1440ul, min0.temp, max0.temp, 120.0f, 10.0f, &yax0,
                &yax1, &step);
         aprsstr_FixToStr(lastval->temp, 2UL, s, 256ul);
         aprsstr_Append(s, 256ul, "\177C ", 4ul);
         aprsstr_Append(s, 256ul, h, 256ul);
         paper(img, yax0, yax1, step, 8UL, Maxx, 120UL, s, 256ul);
         timeline(stime, img, Maxx);
         dots(XStep, img, temp, 1440ul, 1, 200UL, 700UL, 40UL);
      }
   }
   if (max0.baro!=(-1.E+4f)) {
      have |= 0x2U;
      if ((0x2U & *what)) {
         if (!newimg(Maxx, img)) return;
         scale(baro, 1440ul, min0.baro, max0.baro, 120.0f, 2.0f, &yax0,
                &yax1, &step);
         aprsstr_FixToStr(lastval->baro, 2UL, s, 256ul);
         aprsstr_Append(s, 256ul, "hPa ", 5ul);
         aprsstr_Append(s, 256ul, h, 256ul);
         paper(img, yax0, yax1, step, 8UL, Maxx, 120UL, s, 256ul);
         timeline(stime, img, Maxx);
         dots(XStep, img, baro, 1440ul, 1, 500UL, 400UL, 500UL);
      }
   }
   if (max0.wind!=(-1.E+4f) && max0.wind>0.0f) {
      have |= 0x8U;
      if ((0x8U & *what)) {
         if (!newimg(Maxx, img)) return;
         scale(winds, 1440ul, (-1.E+4f), max0.wind, 120.0f, 20.0f, &yax0,
                &yax1, &step);
         scale(gust, 1440ul, (-1.E+4f), max0.wind, 120.0f, 20.0f, &yax0,
                &yax1, &step);
         s[0U] = 0;
         if (lastval->winds!=0.0f || lastval->gust==0.0f) {
            aprsstr_FixToStr(lastval->winds, 2UL, hh, 256ul);
            aprsstr_Append(hh, 256ul, "km/h Wind  ", 12ul);
            aprsstr_Append(s, 256ul, hh, 256ul);
         }
         if (lastval->gust!=0.0f) {
            aprsstr_FixToStr(lastval->gust, 2UL, hh, 256ul);
            aprsstr_Append(hh, 256ul, "km/h Gust  ", 12ul);
            aprsstr_Append(s, 256ul, hh, 256ul);
         }
         aprsstr_Append(s, 256ul, h, 256ul);
         paper(img, yax0, yax1, step, 8UL, Maxx, 120UL, s, 256ul);
         timeline(stime, img, Maxx);
         dots(XStep, img, winds, 1440ul, 1, 100UL, 500UL, 700UL);
         dots(XStep, img, gust, 1440ul, 1, 600UL, 100UL, 0UL);
      }
      if (dirvalid) {
         have |= 0x10U;
         if ((0x10U & *what)) {
            if (!newimg(Maxx, img)) return;
            scale(windd, 1440ul, (-1.E+4f), 360.0f, 120.0f, 365.0f, &yax0,
                &yax1, &step);
            aprsstr_FixToStr(lastval->winddir, 0UL, s, 256ul);
            aprsstr_Append(s, 256ul, "deg Wind Direction ", 20ul);
            aprsstr_Append(s, 256ul, h, 256ul);
            paper(img, yax0, yax1, 90UL, 8UL, Maxx, 120UL, s, 256ul);
            timeline(stime, img, Maxx);
            dots(XStep, img, windd, 1440ul, 0, 200UL, 700UL, 700UL);
         }
      }
   }
   if (max0.hyg!=(-1.E+4f)) {
      have |= 0x4U;
      if ((0x4U & *what)) {
         if (!newimg(Maxx, img)) return;
         scale(hyg, 1440ul, (-1.E+4f), 100.0f, 120.0f, 101.0f, &yax0, &yax1,
                &step);
         aprsstr_FixToStr(lastval->hyg, 0UL, s, 256ul);
         aprsstr_Append(s, 256ul, "% Humidty ", 11ul);
         aprsstr_Append(s, 256ul, h, 256ul);
         paper(img, yax0, yax1, step, 8UL, Maxx, 120UL, s, 256ul);
         timeline(stime, img, Maxx);
         dots(XStep, img, hyg, 1440ul, 1, 0UL, 500UL, 700UL);
      }
   }
   if (max0.lumi!=(-1.E+4f)) {
      have |= 0x40U;
      if ((0x40U & *what)) {
         if (!newimg(Maxx, img)) return;
         scale(lumi, 1440ul, (-1.E+4f), max0.lumi, 120.0f, 50.0f, &yax0,
                &yax1, &step);
         aprsstr_FixToStr(lastval->lumi, 0UL, s, 256ul);
         aprsstr_Append(s, 256ul, "W/m^2 Luminosity ", 18ul);
         aprsstr_Append(s, 256ul, h, 256ul);
         paper(img, yax0, yax1, step, 8UL, Maxx, 120UL, s, 256ul);
         timeline(stime, img, Maxx);
         dots(XStep, img, lumi, 1440ul, 1, 600UL, 600UL, 0UL);
      }
   }
   if (max0.rain!=(-1.E+4f)) {
      have |= 0x20U;
      if ((0x20U & *what)) {
         if (!newimg(Maxx, img)) return;
         scale(rain1, 1440ul, (-1.E+4f), max0.rain, 120.0f, 5.0f, &yax0,
                &yax1, &step);
         scale(rain24, 1440ul, (-1.E+4f), max0.rain, 120.0f, 5.0f, &yax0,
                &yax1, &step);
         scale(rain0, 1440ul, (-1.E+4f), max0.rain, 120.0f, 5.0f, &yax0,
                &yax1, &step);
         aprsstr_FixToStr(lastval->rain, 2UL, s, 256ul);
         aprsstr_Append(s, 256ul, "mm Rain ", 9ul);
         aprsstr_Append(s, 256ul, h, 256ul);
         paper(img, yax0, yax1, step, 8UL, Maxx, 120UL, s, 256ul);
         timeline(stime, img, Maxx);
         dots(XStep, img, rain1, 1440ul, 1, 500UL, 100UL, 0UL);
         dots(XStep, img, rain24, 1440ul, 1, 50UL, 600UL, 50UL);
         dots(XStep, img, rain0, 1440ul, 1, 100UL, 100UL, 700UL);
      }
   }
   if (max0.siev>0.0f) have |= 0x400U;
   *what = have;
/*
  IF img<>NIL THEN DISPOSE(img) END;
*/
} /* end wxgraph() */
Пример #9
0
void display(void)
{
	// ****** declaracoes internas 'a funcao display() ******
	
	float temp;

	// ****** fim de todas as declaracoes da funcao display() ******

	
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
	setCamera();
	
	// permissao de atribuicao directa de cores
	// para objectos que nao tem material atribuido, como
	// e' o caso dos eixos e da esfera que simboliza a fonte de luz...
	/*glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
	glEnable(GL_COLOR_MATERIAL);*/

	// Actualizacao da posicao da fonte de luz...
	light0_position[0] = light0x;	// por razoes de eficiencia, os restantes 
	light0_position[1] = light0y;	// parametros _invariaveis_ da LIGHT0 mantem os valores
	light0_position[2] = light0z;	// definidos na funcao de inicializacao
	glLightfv(GL_LIGHT0, GL_POSITION, light0_position);

	// ... e da esfera que a simboliza
	/*glColor3f(1.0,1.0,0.0);		// cor amarela
	gluQuadricOrientation( glQ, GLU_INSIDE);
	glPushMatrix();
	glTranslated(light0x,light0y,light0z);
	gluSphere(glQ, symb_light0_radius, symb_light0_slices, symb_light0_stacks);
    glPopMatrix();
	gluQuadricOrientation( glQ, GLU_OUTSIDE);

	glDisable(GL_COLOR_MATERIAL);*/
	
	glCallList(DP_GEOMETRY);
	glCallList(DP_MACHINE);
	
	glPushMatrix();

	if(st==ST2){
		glTranslated(centerX,0,centerZ);
		glRotated(ang,0,1,0);
		glTranslated(-centerX,0,-centerZ);
	}
	else if(st==ST5){
		glTranslated(centerX,0,centerZ);
		glRotated(-ang,0,1,0);
		glTranslated(-centerX,0,-centerZ);
	}

	glTranslated(robotXa,0,robotZa);
	if(st==ST3||st==ST4||st==ST5)
		glRotated(90,0,1,0);

	light1_position[0] = light1x;	 
	light1_position[1] = light1y;	
	light1_position[2] = light1z;	

	glLightf(GL_LIGHT1, GL_SPOT_CUTOFF, light1_cone_radius);
	glLightfv(GL_LIGHT1, GL_SPOT_DIRECTION, light1_spot_direction);
	glLightfv(GL_LIGHT1, GL_POSITION, light1_position);

	if(n_newspapers>0){
		glPushMatrix();
		glTranslated(0,paperYf,0);
		paper();
		glPopMatrix();
	}
	glCallList(DP_ROBOT);
	glPopMatrix();

	glPushMatrix();
	glTranslated(printingMachineX,0,printingMachineZ+conveyorZ+machineZ);
	belt(conveyorX,conveyorY,conveyorZ);
	drawNewspapers(newspapersX,newspapersY,newspapersZi,newspapersZf);
	glPopMatrix();

	if(st==ST01){
		glPushMatrix();
		glTranslated(newspaperX,0,newspaperZ);
		drawNewspaper(newspapersX,newspapersY,newspaperZi,newspaperZf);
		glPopMatrix();
	}

	if(st==ST02){
		glPushMatrix();
		glTranslated(newspaperX,paperYa,paperZa);
		paper();
		glPopMatrix();
	}

	glPushMatrix();
	glTranslated(platenX,platenY,platenZ);
	glRotated(-platen_ang,1.0,0.0,0.0);
	platen();
	glPopMatrix();

	glPushMatrix();
	glTranslated(guillotinePosX,guillotineYa,guillotinePosZ);	
	guillotine(guillotineX,guillotineY);
	glPopMatrix();

	showCameraNumber();

	glEnable(GL_NORMALIZE);
	// swapping the buffers causes the rendering above to be shown
	glutSwapBuffers();
	// glFlush(); included in the above glutSwapBuffers()
}
Пример #10
0
QVariant
EnabledLocalesModel::data( const QModelIndex& index, int role ) const
{
    if ( index.row() < 0 || index.row() >= m_locales.count() )
        return QVariant();
    const QString& localeCode = m_locales[index.row()];

    Locale locale( localeCode.toLatin1() );

    // Get language and country in current system locale
    UnicodeString uDisplayLanguage;
    UnicodeString uDisplayCountry;
    locale.getDisplayLanguage( locale, uDisplayLanguage );
    locale.getDisplayCountry( locale, uDisplayCountry );

    // Capitalize language and country
    UErrorCode status;
    BreakIterator* titleIterator = BreakIterator::createTitleInstance( locale, status );
    uDisplayLanguage = uDisplayLanguage.toTitle( titleIterator );
    uDisplayCountry = uDisplayCountry.toTitle( titleIterator );

    QString displayLanguage = unicodeStringToQString( uDisplayLanguage );
    QString displayCountry = unicodeStringToQString( uDisplayCountry );

    switch ( role )
    {
    case Qt::DisplayRole:
        return QString( "%1 - %2 (%3)" ).arg( displayLanguage ).arg( displayCountry ).arg( localeCode );
    case LocaleCodeRole:
        return localeCode;
    case CountryRole:
        return displayCountry;
    case LanguageRole:
        return displayLanguage;
    case AddressRole:
        return address();
    case CollateRole:
        return collate();
    case CtypeRole:
        return ctype();
    case IdentificationRole:
        return identification();
    case LangRole:
        return lang();
    case LanguageLcRole:
        return language();
    case MeasurementRole:
        return measurement();
    case MonetaryRole:
        return monetary();
    case MessagesRole:
        return messages();
    case NameRole:
        return name();
    case NumericRole:
        return numeric();
    case PaperRole:
        return paper();
    case TelephoneRole:
        return telephone();
    case TimeRole:
        return time();
    }

    return QVariant();
}