Ejemplo n.º 1
0
void
Fl_Arc_Dial::draw ( void )
{
    int X = x();
    int Y = y();
    int W = w();
    int H = h();

    draw_box();
    draw_label();

    X += Fl::box_dx(box());
    Y += Fl::box_dy(box());
    W -= Fl::box_dw(box());
    H -= Fl::box_dh(box());

    double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1();

    fl_line_style( FL_SOLID, W / 6 );

    X += W / 8;
    Y += H / 8;
    W -= W / 4;
    H -= H / 4;

    if ( box() == FL_NO_BOX )
    {
        /* draw backgrond arc */
        fl_color( fl_color_average( FL_BLACK, selection_color(), 0.80f ) );
        fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle2() );
    }

    fl_color( selection_color() );
//    fl_color( fl_color_average( FL_RED, selection_color(), ( value() - minimum() ) / ( maximum() - minimum() ) ) );


    if ( type() == FL_FILL_DIAL )
        fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle  );
    else
    {
        const int d = 6;

        /* account for edge conditions */
        angle = angle < angle1() + d ? angle1() + d : angle;
        angle = angle > angle2() - d ? angle2() - d : angle;

        fl_arc( X, Y, W, H, 270 - (angle - d), 270 - (angle + d) );
    }

    fl_line_style( FL_SOLID, 0 );

    fl_color( labelcolor() );

    char s[10];

    fl_font( FL_HELVETICA, 8 );

    snprintf( s, sizeof( s ), "%.1f", value() );
    fl_draw( s, X, Y, W, H, FL_ALIGN_BOTTOM );
}
Ejemplo n.º 2
0
void gDial::draw() {
	double angle = (angle2()-angle1())*(value()-minimum())/(maximum()-minimum()) + angle1();

	fl_color(COLOR_BG_0);
	fl_pie(x(), y(), w(), h(), 270-angle1(), angle > angle1() ? 360+270-angle : 270-360-angle);

	fl_color(COLOR_BD_0);
	fl_arc(x(), y(), w(), h(), 0, 360);
	fl_pie(x(), y(), w(), h(), 270-angle, 270-angle1());
}
Matrix3f ApproachMovementSpace::calculateRotationSimpleXYZ(float angle_x, float angle_y, float angle_z)
{
	AngleAxisf         angle1(angle_x,  Eigen::Vector3f::UnitX());
	AngleAxisf         angle2(angle_y,  Eigen::Vector3f::UnitY());
	AngleAxisf         angle3(angle_z,  Eigen::Vector3f::UnitZ());

	Quaternion<float>  rotation_quaternion = angle1 * angle2 * angle3;

	return rotation_quaternion.matrix();
}
/**************************************************************************************************
 *  Procecure                                                                                     *
 *                                                                                                *
 *  Description: calculateEndEffectorOrientation                                                  *
 *  Class      : ApproachMovementSpace                                                            *
 **************************************************************************************************/
Matrix3f ApproachMovementSpace::calculateRotationMatrixEulerZYZ(float angle_z1, float angle_y1, float angle_z2)
{
	AngleAxisf         angle1(angle_z1,  Eigen::Vector3f::UnitZ());
	AngleAxisf         angle2(angle_y1,  Eigen::Vector3f::UnitY());
	AngleAxisf         angle3(angle_z2,  Eigen::Vector3f::UnitZ());

	Quaternion<float>  rotation_quaternion = angle1 * angle2 * angle3;

	return rotation_quaternion.matrix();
}
Ejemplo n.º 5
0
void
Fl_DialX::draw ( void )
{
    int X,Y,S;

    {
    int ox, oy, ww, hh, side;
    ox = x();
    oy = y();
    ww = w();
    hh = h();
    
    if (ww > hh)
    {
        side = hh;
        ox = ox + (ww - side) / 2;
    }
    else
    {
        side = ww;
        oy = oy + (hh - side) / 2;
    }
    side = w() > h() ? hh : ww;

    X = ox;
    Y = oy;
    S = side;
    }

    draw_box();
    draw_label();

    double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1();

    fl_draw_box( box(), X, Y, S, S, color() );
    
    /* shrink a bit */
    int OX = x();
    int OY = y();
    X += S / 8;
    Y += S / 8;
    int OS = S;
    S -= S / 4;
    
    fl_line_style( FL_SOLID, S / 12 );
        
    /* background arc */
    fl_color( fl_darker( color() ) );
    fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle2() );
        
    /* foreground arc */
    fl_color( selection_color() );
    fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle  );


    fl_line_style( FL_SOLID, 0 );
 
    if ( active_r() )
    {
        int W = OS;
        int H = OS;

        fl_push_matrix();
        fl_translate(OX+W/2, OY+H/2);
        fl_scale(W, H);
        fl_rotate(310+angle);
        fl_color( fl_color_add_alpha( FL_WHITE, 127 ));
        fl_begin_polygon(); fl_circle(-0.26, 0.26, 0.12); fl_end_polygon();
        fl_color( FL_WHITE );
        fl_begin_polygon(); fl_circle(-0.26, 0.26, 0.06); fl_end_polygon();
            
        fl_pop_matrix();
    }
    
    fl_color( fl_contrast( labelcolor(), color() ) );
 
    if ( Fl::belowmouse() == this )
    {
        char s[10];
    
        fl_font( FL_HELVETICA, 10 );
    
        snprintf( s, sizeof( s ), "%.1f", value() );

        fl_color( FL_FOREGROUND_COLOR );
        fl_draw( s, X, Y, S, S, FL_ALIGN_CENTER );
    }
}
Ejemplo n.º 6
0
QString Fixture::status() const
{
    QString info;
    QString t;

    QString title("<TR><TD CLASS='hilite' COLSPAN='3'>%1</TD></TR>");
    QString subTitle("<TR><TD CLASS='subhi' COLSPAN='3'>%1</TD></TR>");
    QString genInfo("<TR><TD CLASS='emphasis'>%1</TD><TD COLSPAN='2'>%2</TD></TR>");

    /********************************************************************
     * General info
     ********************************************************************/

    info += "<TABLE COLS='3' WIDTH='100%'>";

    // Fixture title
    info += title.arg(name());

    // Manufacturer
    if (isDimmer() == false)
    {
        info += genInfo.arg(tr("Manufacturer")).arg(m_fixtureDef->manufacturer());
        info += genInfo.arg(tr("Model")).arg(m_fixtureDef->model());
        info += genInfo.arg(tr("Mode")).arg(m_fixtureMode->name());
        info += genInfo.arg(tr("Type")).arg(m_fixtureDef->type());
    }
    else
    {
        info += genInfo.arg(tr("Type")).arg(tr("Generic Dimmer"));
    }

    // Universe
    info += genInfo.arg(tr("Universe")).arg(universe() + 1);

    // Address
    QString range = QString("%1 - %2").arg(address() + 1).arg(address() + channels());
    info += genInfo.arg(tr("Address Range")).arg(range);

    // Channels
    info += genInfo.arg(tr("Channels")).arg(channels());

    // Binary address
    QString binaryStr = QString("%1").arg(address() + 1, 10, 2, QChar('0'));
    QString dipTable("<TABLE COLS='33' cellspacing='0'><TR><TD COLSPAN='33'><IMG SRC=\"" ":/ds_top.png\"></TD></TR>");
    dipTable += "<TR><TD><IMG SRC=\"" ":/ds_border.png\"></TD><TD><IMG SRC=\"" ":/ds_border.png\"></TD>";
    for (int i = 9; i >= 0; i--)
    {
        if (binaryStr.at(i) == '0')
            dipTable += "<TD COLSPAN='3'><IMG SRC=\"" ":/ds_off.png\"></TD>";
        else
            dipTable += "<TD COLSPAN='3'><IMG SRC=\"" ":/ds_on.png\"></TD>";
    }
    dipTable += "<TD><IMG SRC=\"" ":/ds_border.png\"></TD></TR>";
    dipTable += "<TR><TD COLSPAN='33'><IMG SRC=\"" ":/ds_bottom.png\"></TD></TR>";
    dipTable += "</TABLE>";

    info += genInfo.arg(tr("Binary Address (DIP)"))
            .arg(QString("%1").arg(dipTable));

    /********************************************************************
     * Channels
     ********************************************************************/

    // Title row
    info += QString("<TR><TD CLASS='subhi'>%1</TD>").arg(tr("Channel"));
    info += QString("<TD CLASS='subhi'>%1</TD>").arg(tr("DMX"));
    info += QString("<TD CLASS='subhi'>%1</TD></TR>").arg(tr("Name"));

    // Fill table with the fixture's channels
    for (quint32 ch = 0; ch < channels();	ch++)
    {
        QString chInfo("<TR><TD>%1</TD><TD>%2</TD><TD>%3</TD></TR>");
        info += chInfo.arg(ch + 1).arg(address() + ch + 1)
                .arg(channel(ch)->name());
    }

    /********************************************************************
     * Extended device information for non-dimmers
     ********************************************************************/

    if (isDimmer() == false)
    {
        QLCPhysical physical = m_fixtureMode->physical();
        info += title.arg(tr("Physical"));

        float mmInch = 0.0393700787;
        float kgLbs = 2.20462262;
        QString mm("%1mm (%2\")");
        QString kg("%1kg (%2 lbs)");
        QString W("%1W");
        info += genInfo.arg(tr("Width")).arg(mm.arg(physical.width()))
                                        .arg(physical.width() * mmInch, 0, 'g', 4);
        info += genInfo.arg(tr("Height")).arg(mm.arg(physical.height()))
                                         .arg(physical.height() * mmInch, 0, 'g', 4);
        info += genInfo.arg(tr("Depth")).arg(mm.arg(physical.depth()))
                                        .arg(physical.depth() * mmInch, 0, 'g', 4);
        info += genInfo.arg(tr("Weight")).arg(kg.arg(physical.weight()))
                                         .arg(physical.weight() * kgLbs, 0, 'g', 4);
        info += genInfo.arg(tr("Power consumption")).arg(W.arg(physical.powerConsumption()));
        info += genInfo.arg(tr("DMX Connector")).arg(physical.dmxConnector());

        // Bulb
        QString K("%1K");
        QString lm("%1lm");
        info += subTitle.arg(tr("Bulb"));
        info += genInfo.arg(tr("Type")).arg(physical.bulbType());
        info += genInfo.arg(tr("Luminous Flux")).arg(lm.arg(physical.bulbLumens()));
        info += genInfo.arg(tr("Colour Temperature")).arg(K.arg(physical.bulbColourTemperature()));

        // Lens
        QString angle1("%1&deg;");
        QString angle2("%1&deg; &ndash; %2&deg;");

        info += subTitle.arg(tr("Lens"));
        info += genInfo.arg(tr("Name")).arg(physical.lensName());

        if (physical.lensDegreesMin() == physical.lensDegreesMax())
        {
            info += genInfo.arg(tr("Beam Angle"))
                .arg(angle1.arg(physical.lensDegreesMin()));
        }
        else
        {
            info += genInfo.arg(tr("Beam Angle"))
                .arg(angle2.arg(physical.lensDegreesMin())
                .arg(physical.lensDegreesMax()));
        }


        // Focus
        QString range("%1&deg;");
        info += subTitle.arg(tr("Focus"));
        info += genInfo.arg(tr("Type")).arg(physical.focusType());
        info += genInfo.arg(tr("Pan Range")).arg(range.arg(physical.focusPanMax()));
        info += genInfo.arg(tr("Tilt Range")).arg(range.arg(physical.focusTiltMax()));
    }

    // HTML document & table closure
    info += "</TABLE>";

    if (isDimmer() == false)
    {
        info += "<HR>";
        info += "<DIV CLASS='author' ALIGN='right'>";
        info += tr("Fixture definition author: ") + fixtureDef()->author();
        info += "</DIV>";
    }

    return info;
}
Ejemplo n.º 7
0
void WidgetPDial::draw()
{
#ifdef NTK_GUI
    box( FL_NO_BOX );

    Fl_Dial::draw();
    
    return;
#else
    const int cx = x(), cy = y(), sx = w(), sy = h();
    const double a1 = angle1(), a2 = angle2();
    const double val = (value() - minimum()) / (maximum() - minimum());
    // even radius produces less artifacts if no antialiasing is avail
    const int rad = (sx > sy ? sy : sx) &~1;

    /* clears the button background */
    pdialcolor(160, 160, 160);
    fl_pie(cx - 2, cy - 2, rad + 4, rad + 4, 0, 360);

    /* dark outline */
    fl_color(60, 60, 60);
    fl_pie(cx - 1, cy - 1, rad + 2, rad + 2, 0, 360);

    /* Draws the button faceplate, min/max */
    pdialcolor(110, 110, 115);
    fl_pie(cx, cy, rad, rad, 270 - a2, 270 - a1);

    /* knob center */
    if (rad > 8) {
        pdialcolor(140, 140, 145);
        fl_pie(cx + 4, cy + 4, rad - 8, rad - 8, 0, 360);
    }

    /* value circle */
    double a = -(a2 - a1) * val - a1;
    fl_line_style(0, 2, 0);
    pdialcolor(0, 200, 0);
    fl_arc(cx + 1, cy + 1, rad - 2, rad - 2, a - 90, a1 - 180);
    fl_line_style(0);

    /* draw value line */
    int ll = rad/4;
    if (ll < 2) ll = 2;

    fl_push_matrix();

    fl_translate(cx + rad / 2, cy + rad / 2);
    fl_rotate(a - 90.0f);

    fl_translate(rad / 2, 0);

    fl_begin_polygon();
    pdialcolor(0, 0, 0);
    fl_vertex(-ll, 0);
    fl_vertex(0, 0);
    fl_end_polygon();

    fl_pop_matrix();

#endif
}
Ejemplo n.º 8
0
void Fl_Gauge::draw(void)
{
    int X = x();
    int Y = y();
    int W = w();
    int H = h();

    draw_box();

    X += Fl::box_dx(box());
    Y += Fl::box_dy(box());
    W -= Fl::box_dw(box());
    H -= Fl::box_dh(box());

    double frac = (value() - minimum()) / (maximum() - minimum());
    double angle = (angle2() - angle1()) * frac +  angle1();

    float cx = X + W/2.0f;
    float cy = Y + H/2.0f;

    float d = (float)((W < H)? W : H);

    double num_major_ticks = (maximum() - minimum()) / major_step_size;
    double num_minor_ticks = (maximum() - minimum()) / minor_step_size;

    double minor_angle = (angle2() - angle1()) / num_minor_ticks;
    double major_angle = (angle2() - angle1()) / num_major_ticks;
    int i;

    fl_color(FL_WHITE);
    fl_line_style(FL_SOLID, 1);

/* minor ticks */
    fl_push_matrix();
    fl_color(FL_WHITE);
    fl_translate(cx, cy);
    fl_scale(d, d);
    fl_rotate(-angle1());
    for (i = 0; i <= num_minor_ticks; i++) {
        fl_begin_line();
        fl_vertex(0, 0.40);
        fl_vertex(0, 0.45);
        fl_end_line();
        fl_rotate(-minor_angle);
    }
    fl_pop_matrix();

/* major ticks */
    fl_push_matrix();
    fl_color(FL_WHITE);
    fl_line_style(FL_SOLID, 3);
    fl_translate(cx, cy);
    fl_scale(d, d);
    fl_rotate(-angle1());
    for (i = 0; i <= num_major_ticks; i++) {
        fl_begin_line();
        fl_vertex(0, 0.40);
        fl_vertex(0, 0.47);
        fl_end_line();
        fl_rotate(-major_angle);
    }
    fl_pop_matrix();

/* tick labels */
    char buf[128];
    fl_color(FL_WHITE);
    for (i = 0; i <= num_major_ticks; i++) {
        snprintf(buf, sizeof(buf), "%.0lf", minimum() + i * major_step_size);
        double angle = 360.0 + -angle1() - 90 - i * major_angle;
        double rad = angle * M_PI/180.0;
        int width = 0;
        int height = 0;
        fl_measure(buf, width, height);
        if (width < 1) {
            width = 9;
        }
        if (height < 1) {
            height = 16;
        }
        double radius = d / 3;
        double x = cx + radius * cos(rad);
        double y = cy - radius * sin(rad);
        if (rad < M_PI/2.0 || rad > 3 * M_PI/2.0) {
            x = cx + (radius - width/2.0) * cos(rad);
        }
        x -= width/2.0;
        fl_draw(buf, x, y + height/2.0);
    }

    fl_push_matrix();
    fl_translate(cx, cy);
    fl_scale(d, d);

    fl_color(FL_WHITE);

    fl_rotate(-angle);

/* arrow */
    fl_begin_polygon();
    fl_vertex(-0.02, 0.03);
    fl_vertex(-0.02, 0.35);
    fl_vertex( 0.00, 0.37);
    fl_vertex( 0.02, 0.35);
    fl_vertex( 0.02, 0.03);
    fl_end_polygon();

/* border */
    fl_begin_loop();
    fl_circle(0.0, 0.0, 0.48);
    fl_end_loop();

    fl_pop_matrix();

    fl_color(FL_GRAY);
    fl_pie(cx - d * 0.05, cy - d * 0.05, d * 0.1, d * 0.1, 0, 360.0);
    fl_color(FL_BLACK);
    fl_pie(cx - d * 0.025, cy - d * 0.025, d * 0.05, d * 0.05, 0, 360.0);

    draw_label();
}