Пример #1
0
void FVAnimation::initAttributes()
{
    FVObject * fo;
    double start = 1e10, end=-1e10, step=1e10;
    Field * f;
    QString sFields("");

    std::list< BoxBox *> children = manager->childrenOfBoxObj( (BoxBox*) this );
    std::list< BoxBox *>::iterator it;
    for (it = children.begin(); it != children.end(); it++) {
        fo = (FVObject*) (*it);
        f = reqField.getField( fo );

        if (f != 0) {
            sFields = sFields + f->getAttr("name").c_str() + " ";
            if ( f->isDynamic() ) {
                if (start > f->getMinTime()) start = f->getMinTime();
                if (end < f->getMaxTime()) end = f->getMaxTime();
                if (step > f->getTimeStep()) step = f->getTimeStep();
            } else {
                start = end = step = 0;
                break;
            }
        } else {
            qWarning() << "Unable to read field parameters. Field * f = 0.";
        }
    }
    setAttrValue( tr("Name"), sFields);
    sName = sFields;
    setAttrValue( tr("Start Time:"), QString("%1").arg( start ) );
    setAttrValue( tr("End Time:"), QString("%1").arg( end ) );
    setAttrValue( tr("Time Step:"), QString("%1").arg( step ) );

    setAttrValue( tr("Current Time:"), QString("%1").arg( start ) );

    Attr * a = getAttr( tr("Current Time:") );
    if (a != 0) {
        if (start <= end) {
            a->addListItem( QString("%1").arg( start ) );
        } else
            for (double v = start; v <= end; v += step) {
            a->addListItem( QString("%1").arg( v ) );
        }
    }
}
Пример #2
0
void FVAnimation::setupAttributes( )
{
    Attr * a;
    a = am->addAttr( tr("Type"), tr("Animation"), QString("text") );
    a->setEditable(false);
    a = am->addAttr( tr("Name"), tr("Unknown"), QString("text") );
    a->setEditable(false);

    a = am->addAttr( tr("Start Time:"), QString("%1").arg( 0 ) , QString("text") );
    a->setEditable(false);
    a = am->addAttr( tr("End Time:"), QString("%1").arg( 0 ), QString("text") );
    a->setEditable(false);
    a = am->addAttr( tr("Time Step:"), QString("%1").arg( 0 ), QString("text") );
    a->setEditable(false);

    a = am->addAttr( tr("Current Time:"), QString("%1").arg( 0 ), QString("textlist") );

    a = am->addAttr( tr("Play Speed:"), tr("Stop"), QString("textlist") );
    a->addListItem( tr("Stop") );
    a->addListItem( tr("Turtle") );
    a->addListItem( tr("Slow") );
    a->addListItem( tr("Normal") );
    a->addListItem( tr("Fast") );
    a->addListItem( tr("Cheetah") );
}