Beispiel #1
0
void
QvisText2DInterface::GetCurrentValues(int which_widget)
{
    bool doAll = (which_widget == -1);

    if(which_widget == 0 || doAll)
    {
        // Get the new position
        GetScreenPosition(positionEdit, tr("Lower left"));
    }

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

    if(which_widget == 2 || doAll)
    {
        // Get its new current value and store it in the atts.
        ForceSpinBoxUpdate(heightSpinBox);
        int w = heightSpinBox->value();
        double pos2[3];
        pos2[0] = double(w) * 0.01;
        pos2[1] = annot->GetPosition2()[1];
        pos2[2] = annot->GetPosition2()[2];
        annot->SetPosition2(pos2);
    }
}
void
QvisAxisAttributesWidget::GetCurrentValues(AxisAttributes &aa, 
    int which_group, int which_widget)
{
    bool doAllGroups = which_group == -1;
    bool doAll = which_widget == -1;

    // Do the title group
    if(doAllGroups || which_group == AxisAttributes::ID_title)
    {
        if(doAll || which_widget == AxisTitles::ID_font)
            atts.GetTitle().SetFont(titleFont->getFontAttributes());
        if(doAll || which_widget == AxisTitles::ID_title)
            atts.GetTitle().SetTitle(customTitle->displayText().toStdString());
        if(doAll || which_widget == AxisTitles::ID_units)
            atts.GetTitle().SetUnits(customUnits->displayText().toStdString());
    }

    // Do the label group
    if(doAllGroups || which_group == AxisAttributes::ID_title)
    {
        if(doAll || which_widget == AxisLabels::ID_font)
            atts.GetLabel().SetFont(labelFont->getFontAttributes());
        if(doAll || which_widget == AxisLabels::ID_scaling)
        {
            ForceSpinBoxUpdate(labelScaling);
            atts.GetLabel().SetScaling(labelScaling->value());
        }
    }

    // Do the ticks group
    if(doAllGroups || which_group == AxisAttributes::ID_tickMarks)
    {
        if(doAll || which_widget == AxisTickMarks::ID_majorMinimum)
        {
            double val;
            if(GetDouble(val, majorMinimum, "majorMinimum"))
                atts.GetTickMarks().SetMajorMinimum(val);
        }
        if(doAll || which_widget == AxisTickMarks::ID_majorMaximum)
        {
            double val;
            if(GetDouble(val, majorMaximum, "majorMaximum"))
                atts.GetTickMarks().SetMajorMaximum(val);
        }
        if(doAll || which_widget == AxisTickMarks::ID_minorSpacing)
        {
            double val;
            if(GetDouble(val, minorSpacing, "minorSpacing"))
                atts.GetTickMarks().SetMinorSpacing(val);
        }
        if(doAll || which_widget == AxisTickMarks::ID_majorSpacing)
        {
            double val;
            if(GetDouble(val, majorSpacing, "majorSpacing"))
                atts.GetTickMarks().SetMajorSpacing(val);
        }
    }
}
void
QvisLegendAttributesInterface::GetCurrentValues(int which_widget)
{
    bool doAll = (which_widget == -1);

    if(which_widget == 0 || doAll)
    {
        // Get the new position
        GetScreenPosition(positionEdit, tr("Lower left"));
    }

    if(which_widget == 1 || doAll)
    {
        QString fmt(formatString->text());
        int count = 0;
        for(int i = 0; i < fmt.length(); ++i)
            if(fmt[i] == '%')
                ++count;
        if(count == 0)
        {
            Error(tr("The format string for the legend was not used because it "
                     "does not contain a '%' character."));
        }
        else if(count > 1)
        {
            Error(tr("The format string for the legend was not used because it "
                     "contains multiple '%' characters."));
        }
        else
        {
            stringVector sv;
            sv.push_back(formatString->text().toStdString());
            annot->SetText(sv);
        }
    }

    if(which_widget == 2 || doAll)
    {
        // Get its new current value and store it in the atts.
        ForceSpinBoxUpdate(widthSpinBox);
        int w = widthSpinBox->value();
        double pos2[3];
        pos2[0] = double(w) * (1. / WIDTH_HEIGHT_PRECISION);
        pos2[1] = annot->GetPosition2()[1];
        pos2[2] = annot->GetPosition2()[2];
        annot->SetPosition2(pos2);
    }

    if(which_widget == 3 || doAll)
    {
        // Get its new current value and store it in the atts.
        ForceSpinBoxUpdate(heightSpinBox);
        int h = heightSpinBox->value();
        double pos2[3];
        pos2[0] = annot->GetPosition2()[0];
        pos2[1] = double(h) * (1. / WIDTH_HEIGHT_PRECISION);
        pos2[2] = annot->GetPosition2()[2];
        annot->SetPosition2(pos2);
    }

    if(which_widget == 4 || doAll)
    {
        bool okay;
        double val = fontHeight->text().toDouble(&okay);
        if(okay)
            annot->SetDoubleAttribute1(val);
    }

    if (which_widget == AnnotationObject::ID_intAttribute2 || doAll)
    {
        annot->SetIntAttribute2(numTicksSpinBox->value());
    }
    if (which_widget == AnnotationObject::ID_doubleVector1 || doAll)
    {
        doubleVector temp;
        double d;
        QString txt; 
        int nRows = suppliedLabels->rowCount();

        // Qt 4.6 on Mac doesn't update properly.  This trick tickles it
        // into a good state.
        int currentRow = suppliedLabels->currentRow();
        int currentCol = suppliedLabels->currentColumn();
        suppliedLabels->setCurrentCell(currentRow, (currentCol==0? 1 :0));
        suppliedLabels->setCurrentCell(currentRow, currentCol);

        bool okay;
        for (int rowNum = 0; rowNum < nRows; ++rowNum)
        {
            txt = suppliedLabels->item(rowNum, 0)->text().simplified();
            d = txt.toDouble(&okay);
            if (okay)
                temp.push_back(d);
        }
        annot->SetDoubleVector1(temp);
    }
    if (which_widget == AnnotationObject::ID_stringVector1 || doAll)
    {
        stringVector temp;
        QString txt; 

        // Qt 4.6 on Mac doesn't update properly.  This trick tickles it
        // into a good state.
        int currentRow = suppliedLabels->currentRow();
        int currentCol = suppliedLabels->currentColumn();
        suppliedLabels->setCurrentCell(currentRow, (currentCol==0? 1 :0));
        suppliedLabels->setCurrentCell(currentRow, currentCol);

        int nRows = suppliedLabels->rowCount();
        for (int rowNum = 0; rowNum < nRows; ++rowNum)
        {
            txt = suppliedLabels->item(rowNum, 1)->text();
            temp.push_back(txt.trimmed().toStdString());
        }
        annot->SetStringVector1(temp);
    }
}
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);
    }
}