void FieldAnimation::internalUpdate(const Real32& t, const Real32 prev_t) { if(getContainer() == NULL || getFieldId() == 0) { SWARNING << "There is no Field Container defined to Animate" << std::endl; return; } EditFieldHandlePtr TheField = getContainer()->editField( getFieldId() ); //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; } //Update the Field Container if( getAnimator()->animate( static_cast<Animator::InterpolationType>(getInterpolationType()), static_cast<Animator::ValueReplacementPolicy>(getReplacementPolicy()), (getCycling() < 0) || (getCycling() > getCycles()), t, prev_t, TheField, getIndex()) ) { commitChanges(); } }
void QMFieldView::mouseDoubleClickEvent(QMouseEvent *pEvent) { bool bValid = false; UInt32 uiIndex = pointToIndex(pEvent->pos(), bValid); if(bValid && (uiIndex < getFieldPtr()->getSize())) { emit doubleClicked(getFieldContainer(), getFieldId(), uiIndex, pEvent->button()); } }
osg::Real32 FieldAnimationAdvancer::getValue(void) const { if(getFieldId() == 0) { //Check if the Field Container is defined if(getContainer() == osg::NullFC) { SWARNING << "There is no Field Container defined to get Field Advancer" << std::endl; return 0.0f; } //Check if the field in this container is defined FieldDescription * f = getContainer()->getType().findFieldDescription(getFieldName().c_str()); if( f == NULL ) { SWARNING << "Could not find Field "<< getFieldName() << " in Field Container " << getContainer()->getTypeName() << std::endl; return 0.0f; } //Found the Field so set my Field Id beginEditCP(FieldAnimationAdvancerPtr(this), FieldIdFieldMask); const_cast<SFUInt32*>(&_sfFieldId)->setValue(f->getFieldId()); endEditCP(FieldAnimationAdvancerPtr(this), FieldIdFieldMask); //The Field was not found if(getFieldId() == 0) { SWARNING << "Could not find Field "<< getFieldName() << " in Field Container " << getContainer()->getTypeName() << std::endl; return 0.0f; } //Check if the field is a Real32 if(getContainer()->getField( getFieldId() )->getType() != SFReal32::getClassType()) { SWARNING << "Field "<< getFieldName() << " in Field Container " << getContainer()->getTypeName() << "Is not a SFReal32 Field." << std::endl; return 0.0f; } } return static_cast<SFReal32*>(getContainer()->getField( getFieldId() ))->getValue(); }
void QSFieldView::setFieldId(UInt32 uiFieldId) { if(uiFieldId == getFieldId()) return; endEdit(); delete _pLabel; delete _pEditor; Inherited::setFieldId(uiFieldId); initSelf(); }
void QMFieldView::setFieldId(UInt32 uiFieldId) { if(uiFieldId == getFieldId()) return; endEdit(); deleteAllLabels(); delete _pEditor; Inherited::setFieldId(uiFieldId); initSelf (); initScrollbar(); _bContentsChanged = true; }
void URLFormWidget::validateData() { bool valid; QString editMetadata = MetadataEngine::getInstance().getFieldProperties( MetadataEngine::EditProperty, getFieldId()); FormWidgetValidator validator(editMetadata, MetadataEngine::URLTextType); QString errorMessage; valid = validator.validate(getData(), errorMessage); if (valid) { emit dataEdited(); } else { //restore last valid value m_lineEdit->undo(); //inform FormView that the widget needs attention //by animating the widget emit requiresAttention(errorMessage); } }
void QSFieldView::mouseDoubleClickEvent(QMouseEvent *pEvent) { emit doubleClicked(getFieldContainer(), getFieldId(), 0, pEvent->button()); }
void QSFieldView::mousePressEvent(QMouseEvent *pEvent) { emit clicked(getFieldContainer(), getFieldId(), 0, pEvent->button()); }
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; } } }
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; } } }
int csimClass::getFieldSizeByName(char *o, char *name) { return getFieldSizeById(o,getFieldId(name)); }
int csimClass::getFieldByName(char *o, char *name, double *v) { return getFieldById(o,getFieldId(name),v); }