Example #1
0
void
QvisScreenPositionEdit::returnPressed()
{
    double newX, newY;
    if(getCurrentValues(&newX, &newY))
    {
        newScreenPosition(newX, newY);
        screenPositionPopup->setScreenPosition(screenX, screenY);
    }
}
Example #2
0
bool
QvisScreenPositionEdit::getPosition(double &x, double &y)
{
    bool okay = false;
    double newX, newY;

    if((okay = getCurrentValues(&newX, &newY)) == true)
    {
        screenX = newX;
        screenY = newY;
    }

    x = screenX;
    y = screenY;
    return okay;
}
Example #3
0
void VectorWidget::step()
{
    reset();
    getCurrentValues();

    phasor1_x.append(yScale->position());
    phasor1_y.append(xScale->position());

    phasor1_x.append(wave1_amplitude * cos(wave1_frequency * elapsedTime));
    phasor1_y.append(wave1_amplitude * sin(wave1_frequency * elapsedTime));

    phasor2_x.append(phasor1_x.back());
    phasor2_y.append(phasor1_y.back());

    phasor2_x.append(phasor1_x.back() + wave2_amplitude * cos(wave2_frequency * elapsedTime + phaseShift));
    phasor2_y.append(phasor1_y.back() + wave2_amplitude * sin(wave2_frequency * elapsedTime + phaseShift));

    sumVector_x.append(yScale->position());
    sumVector_y.append(xScale->position());

    sumVector_x.append(phasor2_x.back());
    sumVector_y.append(phasor2_y.back());

    plotLine_x.append(sumVector_x.back());
    plotLine_y.append(sumVector_y.back());

    plotLine_x.append(this->frameSize().width());
    plotLine_y.append(plotLine_y.back());

    phasor1->setData(phasor2_x, phasor2_y); // Sorry, a little hackish, but it's the easiet way to flip the vectors
    phasor1->attach(this);

    phasor2->setData(phasor1_x, phasor1_y); // Sorry, a little hackish, but it's the easiet way to flip the vectors
    phasor2->attach(this);

    sumVector->setData(sumVector_x, sumVector_y);
    sumVector->attach(this);

    plotLine->setData(plotLine_x, plotLine_y);
    plotLine->attach(this);

    replot();
}