void drawInput0826(){ TFile* f = TFile::Open("signal-600to4500.root"); c1 = new TCanvas("c1","",1360,768); gStyle->SetOptStat(0000000000); drawBase(f,1,"signal 600-4500GeV"); f->Close(); string masspoint[13]={"600","800","1000","1200","1400","1600","1800","2000","2500","3000","3500","4000","4500"}; for (int massP=0;massP<13;massP++){ TFile* f = TFile::Open(Form("signal-%s.root",masspoint[massP].data())); drawBase(f,3,Form("signal %sGeV",masspoint[massP].data())); if(massP==0)drawPt2to1(f,1,Form("signal %sGeV",masspoint[massP].data())); else drawPt2to1(f,3,Form("signal %sGeV",masspoint[massP].data())); f->Close(); } f = TFile::Open("DY.root"); drawBase(f,2,"DY"); drawPt2to1(f,3,"DY"); drawPt2to1(f,3,"DY",1); drawPt2to1(f,2,"DY",2); TH1F * fatCSV[14], * sub1CSV [14], *sub2CSV[14]; for (int massP=0;massP<13;massP++){ //TFile* f = TFile::Open(Form("signal-%s.root",masspoint[massP].data())); //drawBase(f,3,Form("signal %sGeV",masspoint[massP].data())); //f->Close(); fatCSV[massP]=getCSV(Form("signal-%s.root",masspoint[massP].data()),"fatCSV"); sub1CSV[massP]=getCSV(Form("signal-%s.root",masspoint[massP].data()),"sub1CSV"); sub2CSV[massP]=getCSV(Form("signal-%s.root",masspoint[massP].data()),"sub2CSV"); } fatCSV[13]=getCSV("DY.root","fatCSV"); sub1CSV[13]=getCSV("DY.root","sub1CSV"); sub2CSV[13]=getCSV("DY.root","sub2CSV"); c1->cd(0); c1->SetGrid(); TH1F* TH1[5]; TH1[0]=fatCSV[13]; for(int i=0;i<5;i++)TH1[i+1]=fatCSV[i]; drawB(TH1,"DY","600","800","1000","1200","fatCSV",1,"CSV"); drawEE(TH1,"600","800","1000","1200","fatCSV ROC",3); TH1[1]=fatCSV[5]; TH1[2]=fatCSV[7]; TH1[3]=fatCSV[9]; TH1[4]=fatCSV[12]; drawB(TH1,"DY","1600","2000","3000","4500","fatCSV",3,"CSV"); drawEE(TH1,"1600","2000","3000","4500","fatCSV ROC",3); //TH1F* test =drawE("signal-600.root","DY.root"); //test->Draw(); drawEE("600","800","1000","1200","subCSV ROC",3); drawEE("1600","2000","3000","4500","subCSV ROC",2); }
int main() { FILE *f = fopen("pentam1.in","r+"); char mas[9][9]; int n,i,j,x,y; char c; fscanf(f,"%d\n",&n); for(i = 1; i<= 8; i++) { for(j = 1; j<= 8; j++) { mas[i][j]='0'; } } for(i = 0 ; i < n ; i++) { fscanf(f,"%c %d %d\n",&c, &x, &y); switch (c) { case 'A': drawA(mas,x,8-y+1); break; case 'B': drawB(mas,x,8-y+1); break; case 'C': drawC(mas,x,8-y+1); break; default: printf("Did not recognize shape(Not A, B or C )! \n"); } } fclose(f); int rez = 0; f = fopen("pentam1.out","w+"); //count the symbols for(i = 1; i<= 8; i++) { for(j = 1; j<= 8; j++) { //fprintf(f,"%c ",mas[i][j]); if(mas[i][j]=='x') rez++; } // fprintf(f,"\n"); } fprintf(f,"%d",rez); fclose(f); return 0; }
void onDraw() { /*setViewer O(1)*/ setMatrixMode(PROJECTION); initMatrix(); setViewer(vertex(eyex, eyey, eyez), vertex(lookx, looky, lookz), vertex(upx, upy, upz)); setFrustum(10, 10*MAX_H/MAX_W, 4, 25); /*createPolygons O(1)*/ initScene(); setMatrixMode(MODELVIEW); initMatrix(); if(!Aisclippingwindow) drawA(Ax, Ay, Az); drawB(Bx, By, Bz); /*drawPixels*/ renderScene(); glDrawPixels(MAX_W, MAX_H, GL_RGBA, GL_BYTE, data); glFlush(); }
void Airspace::drawFlarmAlertZone( QPainter* targetP, qreal opacity ) { if( ! GeneralConfig::instance()->getItemDrawingEnabled(typeID) || ! glConfig->isBorder(typeID) || ! isVisible() ) { return; } if( m_flarmAlertZone.isValid() == false || m_flarmAlertZone.isActive() == false ) { return; } // Map radius to map scale int scaledRadius = (int) rint( double(m_flarmAlertZone.Radius) / glMapMatrix->getScale() ); // project center point to map QPoint pcp = glMapMatrix->wgsToMap( m_flarmAlertZone.Latitude, m_flarmAlertZone.Longitude ); // map projected center point to map display QPoint mcp = glMapMatrix->map( pcp ); QBrush drawB( glConfig->getDrawBrush(typeID) ); if( opacity <= 100.0 ) { // use solid filled air regions drawB.setStyle( Qt::SolidPattern ); } QPen drawP = glConfig->getDrawPen(typeID); drawP.setJoinStyle(Qt::RoundJoin); int lw = GeneralConfig::instance()->getAirspaceLineWidth(); if( lw > 1 && glConfig->useSmallIcons() ) { lw = (lw + 1) / 2; } drawP.setWidth(lw); targetP->setPen(drawP); targetP->setBrush(drawB); if( opacity <= 100.0 && opacity > 0.0 ) { // Draw airspace filled with opacity factor targetP->setOpacity( opacity/100.0 ); targetP->drawEllipse( mcp.x() - scaledRadius, mcp.y() - scaledRadius, scaledRadius * 2, scaledRadius * 2 ); // Reset opacity, that a solid line is drawn as next targetP->setBrush(Qt::NoBrush); targetP->setOpacity( 1.0 ); } else if( opacity == 0.0 ) { // Draw only the alert zone borders without any filling inside targetP->setBrush(Qt::NoBrush); targetP->setOpacity( 1.0 ); } // Draw the outline of the alert zone with the selected brush targetP->drawEllipse( mcp.x() - scaledRadius, mcp.y() - scaledRadius, scaledRadius * 2, scaledRadius * 2 ); }
void Airspace::drawRegion( QPainter* targetP, qreal opacity ) { // qDebug("Airspace::drawRegion(): TypeId=%d, opacity=%f, Name=%s", // typeID, opacity, getInfoString().toLatin1().data() ); if( ! GeneralConfig::instance()->getItemDrawingEnabled(typeID) || ! glConfig->isBorder(typeID) || ! isVisible()) { return; } if( m_flarmAlertZone.isValid() ) { // A Flarm Alert zone has to be drawn. drawFlarmAlertZone( targetP, opacity ); return; } QPolygon mP = glMapMatrix->map(projPolygon); if( mP.size() < 3 ) { return; } QPainterPath pp; pp.moveTo( mP.at(0) ); for( int i = 1; i < mP.size(); i++ ) { pp.lineTo( mP.at(i) ); } pp.closeSubpath(); QBrush drawB( glConfig->getDrawBrush(typeID) ); if( opacity <= 100.0 ) { // use solid filled air regions drawB.setStyle( Qt::SolidPattern ); } QPen drawP = glConfig->getDrawPen(typeID); drawP.setJoinStyle(Qt::RoundJoin); int lw = GeneralConfig::instance()->getAirspaceLineWidth(); extern MapConfig* _globalMapConfig; if( lw > 1 && _globalMapConfig->useSmallIcons() ) { lw = (lw + 1) / 2; } drawP.setWidth(lw); targetP->setPen(drawP); targetP->setBrush(drawB); if( opacity <= 100.0 && opacity > 0.0 ) { // Draw airspace filled with opacity factor targetP->setOpacity( opacity/100.0 ); targetP->drawPolygon(mP); // Reset opacity, that a solid line is drawn as next targetP->setBrush(Qt::NoBrush); targetP->setOpacity( 1.0 ); } else if( opacity == 0.0 ) { // draw only airspace borders without any filling inside targetP->setBrush(Qt::NoBrush); targetP->setOpacity( 1.0 ); } // Draw the outline of the airspace with the selected brush targetP->drawPath(pp); }