Logo Search packages:      
Sourcecode: sailcut version File versions  Download package

void CFormMain::slotPrintData (  )  [protected, virtual, slot]

Print the current sail data.

Definition at line 623 of file formmain.cpp.

References CSailDef::clothW, CSailDef::dihedralDeg, CSailDef::footL, CSailDef::footR, CSailDef::footRP, CSailDef::foreI, CSailDef::foreJ, CSailDef::gaffDeg, CSailDef::gaffL, CSailDef::gaffR, CSailDef::gaffRP, CSailDef::hemsW, CSailDef::leechHemW, CSailDef::leechL, CSailDef::leechR, CSailDef::leechRP, CSailDef::LOA, CSailDef::luffL, CSailDef::luffR, CSailDef::mould, CSailDef::nbGores, CSailDef::nbLuffGores, CSailDef::nbSections, CSailMould::profile, CSailDef::rake, CSailDef::sailCut, saildef, CSailDef::sailID, CSailDef::sailType, CSailDef::seamW, CSailDef::sheetDeg, CSailDef::tackX, CSailDef::tackY, CSailDef::twistDeg, and CSailMould::vertpos.

Referenced by setupMenuBar().

{  // try printing
    try
    { // Epson printer scale is 72 pixel/inch
        QPrinter myprinter;
        myprinter.setOrientation(QPrinter::Portrait);
        myprinter.setFullPage(FALSE);

        QPrintDialog printDialog(&myprinter, this);
        if ( printDialog.exec() == QDialog::Accepted )
        {
            QPainter painter(&myprinter);

            //double aspect = (double)myprinter.widthMM() / (double)myprinter.heightMM();
            unsigned int dpix = myprinter.logicalDpiX();
            //unsigned int dpiy = myprinter.logicalDpiY();
            real scale = dpix/72;

            unsigned int fontsz1 = 10;
            painter.setFont(QFont("times", fontsz1 ));
            QString text1=" ", text2=" ", text3=" ", text4=" ";
            unsigned int x=0, x1=0, x2=0, x3=0, x4=0, y=0, w=0, h=0;
            x1 = int(scale*72);  // first position at 1 inch
            x2 = x1 + int(scale*22*fontsz1);
            x3 = x2 + int(scale*12*fontsz1);
            x4 = x3 + int(scale*12*fontsz1); // fourth position
            h = int(scale*1.5*fontsz1); // line spacing

            // text of page header
            y = int(1+scale*(2*fontsz1));
            x = int(x1*0.6);
            painter.drawText(x,y, tr("Sailcut data sheet"));

            // text of sail identification
            text2 = saildef.sailID;
            if ( text2.length() < 1 )
                text2="*";
            painter.drawText(x2,y, text2);

            // draw boxe around header
            h = int(scale*(2*fontsz1));
            w = int(scale*(20*fontsz1));
            x = int(x1*0.6-scale*(0.5*fontsz1));
            y = int(1+scale*(0.5*fontsz1));
            painter.drawRect(x,y, w,h);
            // draw boxe around sail ID
            w = int(scale*(36*fontsz1));
            x = int(x2- scale*(0.5*fontsz1));
            painter.drawRect(x,y, w,h);

            // initialise printing font and position
            y = y + 3*h;

            // sail cut and type
            text1 = tr("Sail type");
            switch (saildef.sailType )
            {
            case MAINSAIL:
                text2 = tr("Mainsail");
                break;
            case JIB:
                text2 = tr("Jib");
                break;
            case WING:
                text2 = tr("Wing")+" @ " + QString::number(saildef.dihedralDeg) + tr("deg");
                break;
            }
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            y = y + h;

            text1 = tr("Sail layout");
            switch ( saildef.sailCut )
            {
            case CROSS:
                text2 = tr("Cross Cut");
                break;
            case HORIZONTAL:
                text2 = tr("Horizontal Cut");
                break;
            case RADIAL:
                text2 = tr("Radial Cut");
                break;
            case TWIST:
                text2 = tr("Twist Foot Cut");
                break;
            case VERTICAL:
                text2 = tr("Vertical Cut");
                break;
            case MITRE:
                text2 = tr("Mitre Cut");
                break;
            }
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            if ( saildef.sailCut == RADIAL )
            {
                text1  = QString::number(saildef.nbSections);
                text1  = text1 + tr(" sections,   ");
                text2 = QString::number(saildef.nbGores);
                text1  = text1 +text2 + tr(" head gores,   ");
                text2 = QString::number(saildef.nbLuffGores);
                text1  = text1 +text2 + tr(" luff gores.");
                painter.drawText(x3,y, text1);
            }
            y = y + h;

            painter.drawText(int(x1*0.6),y, tr("Rig "));
            y = y + h;

            //* boat data
            text1 = tr("Boat LOA");
            text2 = QString::number(saildef.LOA);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Fore triangle hoist I");
            text2 = QString::number(saildef.foreI);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Fore triangle base J");
            text2 = QString::number(saildef.foreJ);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Tack position X");
            text2 = QString::number(saildef.tackX);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Tack height Y");
            text2 = QString::number(saildef.tackY);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            painter.drawText(int(x1/2),y, tr("Sail dimensions"));
            y = y + h;

            // sides of the sail
            text1 = tr("Luff length");
            text2 = QString::number(saildef.luffL);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Mast/Luff rake");
            text2 = QString::number(saildef.rake);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Gaff angle wrt luff");
            text2 = QString::number(saildef.gaffDeg);
            text3 = "deg.";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Gaff length");
            text2 = QString::number(saildef.gaffL);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Foot length");
            text2 = QString::number(saildef.footL);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Leech length");
            text2 = QString::number(saildef.leechL);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            painter.drawText(int(x1/2), y, tr("Shape of edges"));
            y = y + h;

            // shape of sides
            text1 = tr("Luff round");
            text2 = QString::number(saildef.luffR);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Gaff round");
            text2 = QString::number(saildef.gaffR);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Leech round");
            text2 = QString::number(saildef.leechR);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Foot round");
            text2 = QString::number(saildef.footR);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Luff round position");
            text2 = QString::number(saildef.footRP);
            text3 = "%";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Gaff round position");
            text2 = QString::number(saildef.gaffRP);
            text3 = "%";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Leech round position");
            text2 = QString::number(saildef.leechRP);
            text3 = "%";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            text1 = tr("Foot round position");
            text2 = QString::number(saildef.footRP);
            text3 = "%";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            // sail setting
            painter.drawText(int(x1/2), y, tr("Sail settings"));
            y = y + h;

            // twist
            text1 = tr("Twist angle");
            text2 = QString::number(saildef.twistDeg);
            text3 = tr("deg");
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            // sheeting
            text1 = tr("Sheeting angle");
            text2 = QString::number(saildef.sheetDeg);
            text3 = tr("deg");
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y + h;

            painter.drawText(int(x1/2), y, tr("Cloth seams and hems"));
            y = y + h;

            // cloth width, seam and hems width
            text1 = tr("Cloth width");
            text2 = QString::number(saildef.clothW);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y+h;

            text1 = tr("Seams width");
            text2 = QString::number(saildef.seamW);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y+h;

            text1 = tr("Leech hem width");
            text2 = QString::number(saildef.leechHemW);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y+h;

            text1 = tr("Other hem width");
            text2 = QString::number(saildef.hemsW);
            text3 = "mm";
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            y = y+h;

            painter.drawText(int(x1/2), y, tr("Sail mould"));
            y = y + h;
            x = int(scale*fontsz1);
            text2 = tr("Luff factor");
            text3 = tr("Depth");
            text4 = tr("Leech factor");
            painter.drawText(x2-2*x,y, text2);
            painter.drawText(x3-x,y, text3);
            painter.drawText(x4-2*x,y, text4);
            y = y + h;

            text1 = tr("Top profile");
            text2 = QString::number( saildef.mould.profile[2].getLuff() );
            text3 = QString::number( saildef.mould.profile[2].getDepth()*100 )+ "%";
            text4 = QString::number( saildef.mould.profile[2].getLeech() *50);
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            painter.drawText(x4,y, text4);
            y = y + h;

            text1 = tr("Mid profile at h = ") +QString::number( saildef.mould.vertpos )+"%";
            text2 = QString::number( saildef.mould.profile[1].getLuff() );
            text3 = QString::number( saildef.mould.profile[1].getDepth()*100 )+"%";
            text4 = QString::number( saildef.mould.profile[1].getLeech() *50);
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            painter.drawText(x4,y, text4);
            y = y + h;

            text1 = tr("Bottom profile");
            text2 = QString::number( saildef.mould.profile[0].getLuff() );
            text3 = QString::number( saildef.mould.profile[0].getDepth()*100 )+"%";
            text4 = QString::number( saildef.mould.profile[0].getLeech() *50);
            painter.drawText(x1,y, text1);
            painter.drawText(x2,y, text2);
            painter.drawText(x3,y, text3);
            painter.drawText(x4,y, text4);

            // now draw rectangle at end of text
            x = int(scale*fontsz1);
            y = y + h;
            w = x4 - x2 + 3*x;
            h = int(scale*2);
            painter.drawRect (x2-x,y, w,h);
            ///
        }
    }
    catch (CException e)
    {
        QMessageBox::information(this, tr("error"), tr("There was a data printing error"));
    }
}


Generated by  Doxygen 1.6.0   Back to index