/*!\fn void FieldAnimation::setAnimatedMultiField(FieldContainerUnrecPtr TheContainer, UInt32 FieldID, UInt32 Index)
 *
 * \brief Attach to the Index of a MultiField of a #OSG::FieldContainer.
 *
 * If TheContainer is NULL, or there is no MultiField with the
 * given FieldID on the container, or the Index is out of bounds, then no
 * changes are made.
 *
 * \param TheContainer The container to attach to.
 * \param FieldID The ID of the field on the given container to attach
 * to.
 * \param Index The index of the MultiField to attach to.
 */
void FieldAnimation::setAnimatedMultiField(FieldContainerUnrecPtr TheContainer, UInt32 FieldID, UInt32 Index)
{
    setFieldId( FieldID );
    setContainer( TheContainer );
    setIndex( Index );
    commitChanges();
}
/**
\param parent
**/
BcBuscarCentroCosteDelegate::BcBuscarCentroCosteDelegate ( QWidget *parent )
        : BlComboBoxDelegate ( parent )
{
    BL_FUNC_DEBUG
    setQuery ( "SELECT idc_coste, nombre FROM c_coste ORDER BY nombre" );
    setTableName ( "c_coste" );
    setFieldId ( "idc_coste" );
    m_valores["nombre"] = "";
    
}
示例#3
0
/**
\param parent
**/
BusquedaTalla::BusquedaTalla ( QWidget *parent, const char * )
        : BlComboBox ( parent )
{
    BL_FUNC_DEBUG

    setQuery ( "SELECT idtc_talla, nomtc_talla FROM tc_talla ORDER BY nomtc_talla" );
    setTableName ( "tc_talla" );
    setFieldId ( "idtc_talla" );
    m_valores["nomtc_talla"] = "";
    
}
示例#4
0
/**
\param parent
**/
BusquedaTallaDelegate::BusquedaTallaDelegate ( QWidget *parent )
        : BlComboBoxDelegate ( parent )
{
    BL_FUNC_DEBUG
    setSizeAdjustPolicy ( QComboBox::AdjustToContents );
    setQuery ( "SELECT idtc_talla, nomtc_talla FROM tc_talla ORDER BY nomtc_talla" );
    setTableName ( "tc_talla" );
    setFieldId ( "idtc_talla" );
    m_valores["nomtc_talla"] = "";
    setAllowNull(false);
    
}
void FieldAnimation::changed(ConstFieldMaskArg whichField, 
                             UInt32            origin,
                             BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    //Do not respond to changes that have a Sync origin
    if(origin & ChangedOrigin::Sync)
    {
        return;
    }

    if(whichField & FieldNameFieldMask)
    {
        if(getContainer() != NULL)
        {

            FieldDescriptionBase * f = getContainer()->getFieldDescription(getFieldName().c_str());
            if( f == NULL )
            {
                SWARNING << "Could not find Field "<< getFieldName() << " in Field Container " << getContainer()->getTypeName()  << std::endl;
                return;
            }
            else
            {
                setFieldId(f->getFieldId());
                //commitChanges();
            }
        }
        else
        {
            SWARNING << "There is no Field Container defined to Animate"  << std::endl;
            return;
        }
    }
    else if((whichField & FieldIdFieldMask) ||
            (whichField & ContainerFieldMask))
    {
        if(getContainer() != NULL)
        {
            FieldDescriptionBase * f = getContainer()->getFieldDescription(getFieldId());
            if( f == NULL )
            {
                SWARNING << "Could not find Field ID"<< getFieldId() << " in Field Container " << getContainer()->getTypeName()  << std::endl;
                return;
            }
            else
            {
                if(getAnimator()->getDataType() == NULL)
                {
                    SWARNING << "Cannot update animation, because the animator attached to this animation does not work on any data types."  << std::endl;
                    return;
                }
                //Check if it's the right type
                if(getContainer()->getFieldDescription(getFieldId())->getFieldType().getContentType()
                   != *getAnimator()->getDataType())
                {
                    SWARNING << "The data type of the field: "
                             << getContainer()->getFieldDescription(getFieldId())->getName()
                             << " with type: "
                             << getContainer()->getFieldDescription(getFieldId())->getFieldType().getContentType().getCName()
                             << " connected to this animation is not the same data type: "
                             << getAnimator()->getDataType()->getCName()
                             << ", that the animator works on."  << std::endl;
                    return;
                }
            }
        }
        else
        {
            SWARNING << "There is no Field Container defined to Animate"  << std::endl;
            return;
        }
    }
    if(whichField & IndexFieldMask)
    {
        if(getContainer() != NULL)
        {
            FieldDescriptionBase * f = getContainer()->getFieldDescription(getFieldId());
            if( f == NULL )
            {
                SWARNING << "Could not find Field ID"<< getFieldId() << " in Field Container " << getContainer()->getTypeName()  << std::endl;
            }
            else
            {

                //Check if animator supports any types
                if(getAnimator()->getDataType() == NULL)
                {
                    SWARNING << "Cannot update animation, because the animator attached to this animation does not work on any data types."  << std::endl;
                }
                //Check if it's the right type
                if(getContainer()->getFieldDescription(getFieldId())->getFieldType().getContentType()
                   != *getAnimator()->getDataType())
                {
                    SWARNING << "The data type of the field: "
                             << getContainer()->getFieldDescription(getFieldId())->getName()
                             << " with type: "
                             << getContainer()->getFieldDescription(getFieldId())->getFieldType().getContentType().getCName()
                             << " connected to this animation is not the same data type: "
                             << getAnimator()->getDataType()->getCName()
                             << ", that the animator works on."  << std::endl;
                }
                GetFieldHandlePtr TheFieldHandle = getContainer()->getField( getFieldId() );

                if( getIndex() > 0 )
                {
                    if(TheFieldHandle->getCardinality() != FieldType::MultiField)
                    {
                        SWARNING << "Cannot attach to index: " << getIndex() 
                                 << " of field " << getContainer()->getFieldDescription(getFieldId())->getName() 
                                 << " because it has cardinality 1." << std::endl;
                    }
                    else if(getIndex() < TheFieldHandle->size())
                    {
                        SWARNING << "Cannot attach to index: " << getIndex() 
                                 << " of field " << getContainer()->getFieldDescription(getFieldId())->getName() 
                                 << " because that index is out of bounds on a field of size " << TheFieldHandle->size() << "." << std::endl;
                    }
                }
            }
        }
        else
        {
            SWARNING << "There is no Field Container defined to Animate"  << std::endl;
        }
    }
}
/*!\fn void FieldAnimation::setAnimatedField(FieldContainerUnrecPtr TheContainer, UInt32 FieldID)
 *
 * \brief Attach to the SingleField of a #OSG::FieldContainer.
 *
 * If TheContainer is NULL or there is no SingleField with the
 * given FieldID on the container, then no changes are made.
 *
 * \param TheContainer The container to attach to.
 * \param FieldID The ID of the field on the given container to attach
 * to.
 */
void FieldAnimation::setAnimatedField(FieldContainerUnrecPtr TheContainer, UInt32 FieldID)
{
    setFieldId( FieldID );
    setContainer( TheContainer );
    commitChanges();
}
void FieldAnimation::changed(ConstFieldMaskArg whichField,
                             UInt32            origin,
                             BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    if(whichField & FieldNameFieldMask)
    {
        if(getContainer() != NULL)
        {

            FieldDescriptionBase * f = getContainer()->getFieldDescription(getFieldName().c_str());
            if( f == NULL )
            {
                SWARNING << "Could not find Field "<< getFieldName() << " in Field Container " << getContainer()->getTypeName()  << std::endl;
                return;
            }
            else
            {
                setFieldId(f->getFieldId());
                commitChanges();
            }
        }
        else
        {
            SWARNING << "There is no Field Container defined to Animate"  << std::endl;
            return;
        }
    }
    else if((whichField & FieldIdFieldMask) ||
            (whichField & ContainerFieldMask))
    {
        if(getContainer() != NULL)
        {
            FieldDescriptionBase * f = getContainer()->getFieldDescription(getFieldId());
            if( f == NULL )
            {
                SWARNING << "Could not find Field ID"<< getFieldId() << " in Field Container " << getContainer()->getTypeName()  << std::endl;
                return;
            }
            else
            {
                //Check if it's the right type
                if(getContainer()->getFieldDescription(getFieldId())->getFieldType().getContentType() != getAnimator()->getDataType())
                {
                    SWARNING << "The data type of the field: " << getContainer()->getFieldDescription(getFieldId())->getName() << " with type: "  << getContainer()->getFieldDescription(getFieldId())->getFieldType().getContentType().getCName() << " connected to this animation is not the same data type: " << getAnimator()->getDataType().getCName() << ", that the animator works on."  << std::endl;
                    return;
                }
            }
        }
        else
        {
            SWARNING << "There is no Field Container defined to Animate"  << std::endl;
            return;
        }
    }
    if(whichField & IndexFieldMask)
    {
        if(getContainer() != NULL)
        {
            FieldDescriptionBase * f = getContainer()->getFieldDescription(getFieldId());
            if( f == NULL )
            {
                SWARNING << "Could not find Field ID"<< getFieldId() << " in Field Container " << getContainer()->getTypeName()  << std::endl;
                return;
            }
            else
            {

                //Check if it's the right type
                if(getContainer()->getFieldDescription(getFieldId())->getFieldType().getContentType() != getAnimator()->getDataType())
                {
                    SWARNING << "The data type of the field: " << getContainer()->getFieldDescription(getFieldId())->getName() << " with type: "  << getContainer()->getFieldDescription(getFieldId())->getFieldType().getContentType().getCName() << " connected to this animation is not the same data type: " << getAnimator()->getDataType().getCName() << ", that the animator works on."  << std::endl;
                    return;
                }
                const Field* TheField = getContainer()->getField( getFieldId() )->getField();

                if( getIndex() >= 0 &&
                        TheField->getCardinality() != FieldType::MultiField &&
                        getIndex() < TheField->getSize())
                {
                    SWARNING << "If the Index for the field animation is > 0 then the animated field must be a multi field and the index must be less than the size of this field." << getAnimator()->getDataType().getCName() << "."  << std::endl;
                    return;
                }
                else if( getIndex() < 0 &&
                         TheField->getCardinality() != FieldType::SingleField)
                {
                    SWARNING << "If the Index for the field animation is < 0 then the animated field must be a single field." << getAnimator()->getDataType().getCName()  << std::endl;
                }
            }
        }
        else
        {
            SWARNING << "There is no Field Container defined to Animate"  << std::endl;
            return;
        }
    }
}