Пример #1
0
void
QvisLine3DInterface::GetCurrentValues(int which_widget)
{
    bool doAll = (which_widget == -1);
    
    if (doAll || which_widget == 0)
    {
        double v[3];
        if(LineEditGetDoubles(point1Edit, v, 3))
            annot->SetPosition(v);
        else
        {
            QString msg = tr("The start point must be specified as a 3D "
               " coordinate. Resetting to the last good value of %1.").
            arg(DoublesToQString(annot->GetPosition(), 3));
            Error(msg);
            annot->SetPosition(annot->GetPosition());
        }  
    }  
    if (doAll || which_widget == 1)
    {
        double v[3];
        if(LineEditGetDoubles(point2Edit, v, 3))
            annot->SetPosition2(v);
        else
        {
            QString msg = tr("The end point must be specified as a 3D "
               " coordinate. Resetting to the last good value of %1.").
            arg(DoublesToQString(annot->GetPosition2(), 3));
            Error(msg);
            annot->SetPosition2(annot->GetPosition2());
        }
    }  
    if (doAll || which_widget == 2)
    {
        double v;
        doubleVector dv = annot->GetDoubleVector1();
        if(LineEditGetDouble(arrow1Radius, v))
        {
            dv[0] = v;
            annot->SetDoubleVector1(dv);
        }
        else
        {
            QString msg = tr("The radius must be specified as a floating point "
               "value. Resetting to the last good value of %1.").
               arg(DoubleToQString(dv[0]));
            Error(msg);
            annot->SetDoubleVector1(dv);
        }
    }
    if (doAll || which_widget == 3)
    {
        double v;
        doubleVector dv = annot->GetDoubleVector1();
        if(LineEditGetDouble(arrow2Radius, v))
        {
            dv[1] = v;
            annot->SetDoubleVector1(dv);
        }
        else
        {
            QString msg = tr("The radius must be specified as a floating point "
               "value. Resetting to the last good value of %1.").
               arg(DoubleToQString(dv[1]));
            Error(msg);
            annot->SetDoubleVector1(dv);
        }
    }
    if (doAll || which_widget == 4)
    {
        double v;
        doubleVector dv = annot->GetDoubleVector1();
        if(LineEditGetDouble(tubeRadius, v))
        {
            dv[3] = v;
            annot->SetDoubleVector1(dv);
        }
        else
        {
            QString msg = tr("The radius must be specified as a floating point "
               "value. Resetting to the last good value of %1.").
               arg(DoubleToQString(dv[3]));
            Error(msg);
            annot->SetDoubleVector1(dv);
        }
    }
}
void
QvisText3DInterface::GetCurrentValues(int which_widget)
{
    bool doAll = (which_widget == -1);

    if(which_widget == 0 || doAll)
    {
        stringVector sv;
        sv.push_back(textLineEdit->text().toStdString());
        annot->SetText(sv);
    }

    if(which_widget == 1 || doAll)
    {
        double v[3];
        if(LineEditGetDoubles(positionEdit, v, 3))
            annot->SetPosition(v);
        else
        {
            QString msg = tr("The position must be specified as a 3D coordinate. "
                             "Resetting to the last good value of %1.").
                arg(DoublesToQString(annot->GetPosition(), 3));
            Error(msg);
            annot->SetPosition(annot->GetPosition());
        }  
    }

    if(which_widget == 2 || doAll)
    {
        // Get its new current value and store it in the atts.
        ForceSpinBoxUpdate(relativeHeightSpinBox);
        int h = relativeHeightSpinBox->value();
        annot->SetRelativeHeight(h);
    }

    if(which_widget == 3 || doAll)
    {
        double v;
        bool okay = false;
        if(LineEditGetDouble(fixedHeightEdit, v))
        {
            okay = v > 0.;
            if(okay)
                annot->SetFixedHeight(v);
        }

        if (!okay)
        {
            QString msg = tr("The fixed height is a floating point number greater than zero. "
                             "Resetting to the last good value of %1.").
                          arg(annot->GetFixedHeight());
            Error(msg);
            annot->SetFixedHeight(annot->GetFixedHeight());
        }
    }

    if(which_widget == 4 || doAll)
    {
        // Get its new current value and store it in the atts.
        ForceSpinBoxUpdate(rotateZ);
        int r = rotateZ->value();
        double rotations[3];
        rotations[0] = annot->GetRotations()[0];
        rotations[1] = annot->GetRotations()[1];
        rotations[2] = (double)r;
        annot->SetRotations(rotations);
    }

    if(which_widget == 5 || doAll)
    {
        // Get its new current value and store it in the atts.
        ForceSpinBoxUpdate(rotateX);
        int r = rotateX->value();
        double rotations[3];
        rotations[0] = (double)r;
        rotations[1] = annot->GetRotations()[1];
        rotations[2] = annot->GetRotations()[2];
        annot->SetRotations(rotations);
    }

    if(which_widget == 6 || doAll)
    {
        // Get its new current value and store it in the atts.
        ForceSpinBoxUpdate(rotateY);
        int r = rotateY->value();
        double rotations[3];
        rotations[0] = annot->GetRotations()[0];
        rotations[1] = (double)r;
        rotations[2] = annot->GetRotations()[2];
        annot->SetRotations(rotations);
    }
}