void XercesUpdateFactory::setTypes(DOMNode *node, const DOMNode *from) { if(node->getNodeType() == DOMNode::ELEMENT_NODE) { const XMLCh *turi, *tname; XercesNodeImpl::typeUriAndName(from, turi, tname); XercesSequenceBuilder::setElementTypeInfo((DOMElement *)node, turi, tname); DOMNamedNodeMap *attrs = node->getAttributes(); DOMNamedNodeMap *attrsfrom = from->getAttributes(); for(unsigned int i = 0; i < attrs->getLength(); ++i) { DOMNode *a = attrs->item(i); DOMNode *afrom = attrsfrom->getNamedItemNS(a->getNamespaceURI(), Axis::getLocalName(a)); if(afrom) setTypes(a, afrom); } DOMNode *child = node->getFirstChild(); DOMNode *cfrom = from->getFirstChild(); while(child) { if(child->getNodeType() == DOMNode::ELEMENT_NODE) setTypes(child, cfrom); child = child->getNextSibling(); cfrom = cfrom->getNextSibling(); } } else if(node->getNodeType() == DOMNode::ATTRIBUTE_NODE) { const XMLCh *turi, *tname; XercesNodeImpl::typeUriAndName(from, turi, tname); XercesSequenceBuilder::setAttributeTypeInfo((DOMAttr *)node, turi, tname); } }
void XercesUpdateFactory::applyReplaceAttribute(const PendingUpdate &update, DynamicContext *context) { const XercesNodeImpl *nodeImpl = (const XercesNodeImpl*)update.getTarget()->getInterface(Item::gXQilla); DOMAttr *domnode = (DOMAttr*)nodeImpl->getDOMNode(); Node::Ptr parentNode = nodeImpl->dmParent(context); DOMElement *element = domnode->getOwnerElement(); DOMDocument *doc = element->getOwnerDocument(); bool untyped = parentNode->dmNodeKind() == Node::element_string && XPath2Utils::equals(parentNode->getTypeName(), DocumentCache::g_szUntyped) && XPath2Utils::equals(parentNode->getTypeURI(), SchemaSymbols::fgURI_SCHEMAFORSCHEMA); Result children = update.getValue(); Item::Ptr item; while((item = children->next(context)).notNull()) { const XercesNodeImpl *childImpl = (const XercesNodeImpl*)item->getInterface(Item::gXQilla); DOMNode *newChild = importNodeFix(doc, const_cast<DOMNode*>(childImpl->getDOMNode()), /*deep*/true); // 1. Error checks: // a. If the QNames of any two attribute nodes in $replacement have implied namespace bindings that conflict with // each other, a dynamic error is raised [err:XUDY0024]. // b. If the QName of any attribute node in $replacement has an implied namespace binding that conflicts with a // namespace binding in the "namespaces" property of parent($target), a dynamic error is raised [err:XUDY0024]. // Checks performed by UpdateFactory // 2b. If the type-name property of parent($target) is xs:untyped, then upd:setToUntyped() is invoked // on each element node in $replacement. if(!untyped) setTypes(newChild, childImpl->getDOMNode()); // 2a. For each node in $replacement, the parent property is set to parent($target). // 4a. If $target is an attribute node, the attributes property of parent($target) is modified by removing $target // and adding the nodes in $replacement (if any). // 4b. If $target is an attribute node, the namespaces property of parent($target) is modified to include namespace // bindings for any attribute namespace prefixes in $replacement that did not already have bindings. element->setAttributeNode((DOMAttr*)newChild); } // 3a. $target is marked for deletion. forDeletion_.insert(domnode); // 4d. upd:removeType(parent($target)) is invoked. removeType(element); // Use parentNode, since the attr replace could have removed the original attr addToPutSet(parentNode, &update, context); }
void XercesUpdateFactory::applyInsertAfter(const PendingUpdate &update, DynamicContext *context) { const XercesNodeImpl *nodeImpl = (const XercesNodeImpl*)update.getTarget()->getInterface(Item::gXQilla); DOMNode *domnode = const_cast<DOMNode*>(nodeImpl->getDOMNode()); DOMNode *before = domnode->getNextSibling(); Node::Ptr parentNode = nodeImpl->dmParent(context); DOMNode *parent = domnode->getParentNode(); DOMDocument *doc = const_cast<DOMDocument*>(XPath2Utils::getOwnerDoc(domnode)); bool untyped = parentNode->dmNodeKind() == Node::element_string && XPath2Utils::equals(parentNode->getTypeName(), DocumentCache::g_szUntyped) && XPath2Utils::equals(parentNode->getTypeURI(), SchemaSymbols::fgURI_SCHEMAFORSCHEMA); bool containsElementOrText = false; Result children = update.getValue(); Item::Ptr item; while((item = children->next(context)).notNull()) { const XercesNodeImpl *childImpl = (const XercesNodeImpl*)item->getInterface(Item::gXQilla); DOMNode *newChild = importNodeFix(doc, const_cast<DOMNode*>(childImpl->getDOMNode()), /*deep*/true); if(childImpl->dmNodeKind() == Node::element_string || childImpl->dmNodeKind() == Node::text_string) { containsElementOrText = true; } // If the type-name property of parent($target) is xs:untyped, then upd:setToUntyped() is invoked on each // element or attribute node in $content. if(!untyped) setTypes(newChild, childImpl->getDOMNode()); // For each node in $content, the parent property is set to parent($target). // The children property of parent($target) is modified to add the nodes in $content just before $target, // preserving their order. parent->insertBefore(newChild, before); } // If at least one of the nodes in $content is an element or text node, upd:removeType(parent($target)) is invoked. if(containsElementOrText) { removeType(parent); } addToPutSet(update.getTarget(), &update, context); }
DMDatei::DMDatei (const IDMItem::Handle &h) : IDMItem (h) { if ( object () ) { setTypes (IDM::plainText); // sollte aus EA ermitteln addType ("Datei"); enableLink (); enableMove (); enableCopy (); setRMFs (rmfFrom (IDM::rmFile, IDM::rfText)); addRMF (IDM::rmDiscard, IDM::rfUnknown); addRMF (IDM::rmPrint, IDM::rfUnknown); Datei *d = (Datei *)object (); setSourceName (d->iconText ()); setContainerName (Struktur::aktiv ()->path ()); setTargetName (sourceName ()); } }
void XercesUpdateFactory::applyReplaceNode(const PendingUpdate &update, DynamicContext *context) { const XercesNodeImpl *nodeImpl = (const XercesNodeImpl*)update.getTarget()->getInterface(Item::gXQilla); DOMNode *domnode = const_cast<DOMNode*>(nodeImpl->getDOMNode()); Node::Ptr parentNode = nodeImpl->dmParent(context); DOMNode *parent = domnode->getParentNode(); DOMDocument *doc = const_cast<DOMDocument*>(XPath2Utils::getOwnerDoc(domnode)); bool untyped = parentNode->dmNodeKind() == Node::element_string && XPath2Utils::equals(parentNode->getTypeName(), DocumentCache::g_szUntyped) && XPath2Utils::equals(parentNode->getTypeURI(), SchemaSymbols::fgURI_SCHEMAFORSCHEMA); Result children = update.getValue(); Item::Ptr item; while((item = children->next(context)).notNull()) { const XercesNodeImpl *childImpl = (const XercesNodeImpl*)item->getInterface(Item::gXQilla); DOMNode *newChild = importNodeFix(doc, const_cast<DOMNode*>(childImpl->getDOMNode()), /*deep*/true); // 1b. If the type-name property of parent($target) is xs:untyped, then upd:setToUntyped() is invoked // on each element node in $replacement. if(!untyped) setTypes(newChild, childImpl->getDOMNode()); // 1a. For each node in $replacement, the parent property is set to parent($target). // 3b. If $target is an element, text, comment, or processing instruction node, the children property // of parent($target) is modified to add the nodes in $replacement just before $target, preserving // their order. parent->insertBefore(newChild, domnode); } // 2a. $target is marked for deletion. forDeletion_.insert(domnode); // 3c. upd:removeType(parent($target)) is invoked. removeType(parent); addToPutSet(update.getTarget(), &update, context); }
void XercesUpdateFactory::applyInsertAttributes(const PendingUpdate &update, DynamicContext *context) { const XercesNodeImpl *nodeImpl = (const XercesNodeImpl*)update.getTarget()->getInterface(Item::gXQilla); DOMElement *element = (DOMElement*)nodeImpl->getDOMNode(); DOMDocument *doc = const_cast<DOMDocument*>(XPath2Utils::getOwnerDoc(element)); bool untyped = nodeImpl->dmNodeKind() == Node::element_string && XPath2Utils::equals(nodeImpl->getTypeName(), DocumentCache::g_szUntyped) && XPath2Utils::equals(nodeImpl->getTypeURI(), SchemaSymbols::fgURI_SCHEMAFORSCHEMA); Result children = update.getValue(); Item::Ptr item; while((item = children->next(context)).notNull()) { const XercesNodeImpl *childImpl = (const XercesNodeImpl*)item->getInterface(Item::gXQilla); DOMNode *newChild = importNodeFix(doc, const_cast<DOMNode*>(childImpl->getDOMNode()), /*deep*/true); // 1. Error checks: // a. If the QNames of any two attribute nodes in $content have implied namespace bindings that conflict with each other, // a dynamic error is raised [err:XUDY0024]. // b. If the QName of any attribute node in $content has an implied namespace binding that conflicts with a namespace // binding in the "namespaces" property of $target, a dynamic error is raised [err:XUDY0024]. // Checks performed by UpdateFactory // If the type-name property of $target is xs:untyped, then upd:setToUntyped($A) is invoked. if(!untyped) setTypes(newChild, childImpl->getDOMNode()); // The parent property of $A is set to $target. // attributes: Modified to include the nodes in $content. element->setAttributeNode((DOMAttr*)newChild); } // upd:removeType($target) is invoked. removeType(element); addToPutSet(update.getTarget(), &update, context); }
void SkeletonBlendedGeometry::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { Inherited::changed(whichField, origin, details); if((whichField & BaseGeometryFieldMask) && getBaseGeometry() != NULL) { if(getBaseGeometry()->getTypes() != NULL) { setTypes(getBaseGeometry()->getTypes()); } if(getBaseGeometry()->getLengths() != NULL) { setLengths(getBaseGeometry()->getLengths()); } if(getBaseGeometry()->getPositions() != NULL) { GeoPropertyUnrecPtr Pos(getBaseGeometry()->getPositions()->clone()); setPositions(dynamic_pointer_cast<GeoVectorProperty>(Pos)); } if(getBaseGeometry()->getNormals() != NULL) { GeoPropertyUnrecPtr Norm(getBaseGeometry()->getNormals()->clone()); setNormals(dynamic_pointer_cast<GeoVectorProperty>(Norm)); } if(getBaseGeometry()->getColors() != NULL) { setColors(getBaseGeometry()->getColors()); } if(getBaseGeometry()->getSecondaryColors() != NULL) { setSecondaryColors(getBaseGeometry()->getSecondaryColors()); } if(getBaseGeometry()->getTexCoords() != NULL) { setTexCoords(getBaseGeometry()->getTexCoords()); } if(getBaseGeometry()->getTexCoords1() != NULL) { setTexCoords1(getBaseGeometry()->getTexCoords1()); } if(getBaseGeometry()->getTexCoords2() != NULL) { setTexCoords2(getBaseGeometry()->getTexCoords2()); } if(getBaseGeometry()->getTexCoords3() != NULL) { setTexCoords3(getBaseGeometry()->getTexCoords3()); } if(getBaseGeometry()->getTexCoords4() != NULL) { setTexCoords4(getBaseGeometry()->getTexCoords4()); } if(getBaseGeometry()->getTexCoords5() != NULL) { setTexCoords5(getBaseGeometry()->getTexCoords5()); } if(getBaseGeometry()->getTexCoords6() != NULL) { setTexCoords6(getBaseGeometry()->getTexCoords6()); } if(getBaseGeometry()->getTexCoords7() != NULL) { setTexCoords7(getBaseGeometry()->getTexCoords7()); } if(getBaseGeometry()->getIndices() != NULL) { setIndices(getBaseGeometry()->getIndices()); } setMaterial(getBaseGeometry()->getMaterial()); } if( (whichField & InternalJointsFieldMask) || (whichField & InternalWeightIndexesFieldMask) || (whichField & InternalWeightsFieldMask)) { calculatePositions(); } }
void MorphGeometry::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 & BaseGeometryFieldMask) { if(getBaseGeometry() != NULL) { if(getBaseGeometry()->getTypes() != NULL) { GeoIntegralPropertyUnrecPtr Prop = dynamic_pointer_cast<GeoIntegralProperty>(getBaseGeometry()->getTypes()->clone()); setTypes(Prop); } if(getBaseGeometry()->getLengths() != NULL) { GeoIntegralPropertyUnrecPtr Prop = dynamic_pointer_cast<GeoIntegralProperty>(getBaseGeometry()->getLengths()->clone()); setLengths(Prop); } if(getBaseGeometry()->getIndices() != NULL) { GeoIntegralPropertyUnrecPtr Prop = dynamic_pointer_cast<GeoIntegralProperty>(getBaseGeometry()->getIndices()->clone()); setIndices(Prop); } for(UInt16 i(0) ; i<Geometry::LastIndex ; ++i) { if(getBaseGeometry()->getProperty(i) != NULL) { GeoVectorPropertyUnrecPtr Prop = dynamic_pointer_cast<GeoVectorProperty>(getBaseGeometry()->getProperty(i)->clone()); setProperty(Prop, i); } else { setProperty(NULL, i); } } setMaterial(getBaseGeometry()->getMaterial()); } else { setTypes(NULL); setLengths(NULL); for(UInt16 i(0) ; i<Geometry::LastIndex ; ++i) { setProperty(NULL, i); } setIndices(NULL); setMaterial(NULL); } } if((whichField & InternalWeightsFieldMask) || (whichField & InternalTargetGeometriesFieldMask) || (whichField & BaseGeometryFieldMask) || (whichField & MorphPropertiesFieldMask)) { updateMorph(); } }
void SkeletonBlendedGeometry::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 & BaseGeometryFieldMask) && getBaseGeometry() != NULL) { if(getBaseGeometry()->getTypes() != NULL) { setTypes(getBaseGeometry()->getTypes()); } if(getBaseGeometry()->getLengths() != NULL) { setLengths(getBaseGeometry()->getLengths()); } if(getBaseGeometry()->getPositions() != NULL) { GeoPropertyUnrecPtr Pos(getBaseGeometry()->getPositions()->clone()); setPositions(dynamic_pointer_cast<GeoVectorProperty>(Pos)); } if(getBaseGeometry()->getNormals() != NULL) { GeoPropertyUnrecPtr Norm(getBaseGeometry()->getNormals()->clone()); setNormals(dynamic_pointer_cast<GeoVectorProperty>(Norm)); } if(getBaseGeometry()->getColors() != NULL) { setColors(getBaseGeometry()->getColors()); } if(getBaseGeometry()->getSecondaryColors() != NULL) { setSecondaryColors(getBaseGeometry()->getSecondaryColors()); } if(getBaseGeometry()->getTexCoords() != NULL) { setTexCoords(getBaseGeometry()->getTexCoords()); } if(getBaseGeometry()->getTexCoords1() != NULL) { setTexCoords1(getBaseGeometry()->getTexCoords1()); } if(getBaseGeometry()->getTexCoords2() != NULL) { setTexCoords2(getBaseGeometry()->getTexCoords2()); } if(getBaseGeometry()->getTexCoords3() != NULL) { setTexCoords3(getBaseGeometry()->getTexCoords3()); } if(getBaseGeometry()->getTexCoords4() != NULL) { setTexCoords4(getBaseGeometry()->getTexCoords4()); } if(getBaseGeometry()->getTexCoords5() != NULL) { setTexCoords5(getBaseGeometry()->getTexCoords5()); } if(getBaseGeometry()->getTexCoords6() != NULL) { setTexCoords6(getBaseGeometry()->getTexCoords6()); } if(getBaseGeometry()->getTexCoords7() != NULL) { setTexCoords7(getBaseGeometry()->getTexCoords7()); } if(getBaseGeometry()->getIndices() != NULL) { setIndices(getBaseGeometry()->getIndices()); } setMaterial(getBaseGeometry()->getMaterial()); } if(whichField & InternalJointsFieldMask) { _JointPoseTransforms.resize(getNumJoints()); } if( (whichField & BaseGeometryFieldMask) || (whichField & InternalJointsFieldMask) || (whichField & InternalWeightIndexesFieldMask) || (whichField & InternalWeightsFieldMask) || (whichField & BindTransformationFieldMask)) { if(getNumJoints() > 0) { _JointPoseTransforms.resize(getNumJoints()); calculatePositions(); } } }
void SkeletonBlendedGeometry::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { Inherited::changed(whichField, origin, details); if((whichField & BaseGeometryFieldMask) && getBaseGeometry() != NULL) { if(getBaseGeometry()->getTypes() != NULL) { setTypes(getBaseGeometry()->getTypes()); } if(getBaseGeometry()->getLengths() != NULL) { setLengths(getBaseGeometry()->getLengths()); } if(getBaseGeometry()->getPositions() != NULL) { GeoPropertyUnrecPtr Pos(getBaseGeometry()->getPositions()->clone()); setPositions(dynamic_pointer_cast<GeoVectorProperty>(Pos)); } if(getBaseGeometry()->getNormals() != NULL) { GeoPropertyUnrecPtr Norm(getBaseGeometry()->getNormals()->clone()); setNormals(dynamic_pointer_cast<GeoVectorProperty>(Norm)); } if(getBaseGeometry()->getColors() != NULL) { setColors(getBaseGeometry()->getColors()); } if(getBaseGeometry()->getSecondaryColors() != NULL) { setSecondaryColors(getBaseGeometry()->getSecondaryColors()); } if(getBaseGeometry()->getTexCoords() != NULL) { setTexCoords(getBaseGeometry()->getTexCoords()); } if(getBaseGeometry()->getTexCoords1() != NULL) { setTexCoords1(getBaseGeometry()->getTexCoords1()); } if(getBaseGeometry()->getTexCoords2() != NULL) { setTexCoords2(getBaseGeometry()->getTexCoords2()); } if(getBaseGeometry()->getTexCoords3() != NULL) { setTexCoords3(getBaseGeometry()->getTexCoords3()); } if(getBaseGeometry()->getTexCoords4() != NULL) { setTexCoords4(getBaseGeometry()->getTexCoords4()); } if(getBaseGeometry()->getTexCoords5() != NULL) { setTexCoords5(getBaseGeometry()->getTexCoords5()); } if(getBaseGeometry()->getTexCoords6() != NULL) { setTexCoords6(getBaseGeometry()->getTexCoords6()); } if(getBaseGeometry()->getTexCoords7() != NULL) { setTexCoords7(getBaseGeometry()->getTexCoords7()); } if(getBaseGeometry()->getIndices() != NULL) { setIndices(getBaseGeometry()->getIndices()); } setMaterial(getBaseGeometry()->getMaterial()); } if((whichField & JointsFieldMask) || (whichField & PositionIndexesFieldMask) || (whichField & BlendAmountsFieldMask)) { calculatePositions(); } if(whichField & SkeletonsFieldMask) { for(std::vector<EventConnection>::iterator Itor(_SkeletonListenerConnections.begin()) ; Itor != _SkeletonListenerConnections.end() ; ++Itor) { Itor->disconnect(); } _SkeletonListenerConnections.clear(); for(UInt32 i(0) ; i<getMFSkeletons()->size() ; ++i) { _SkeletonListenerConnections.push_back(getSkeletons(i)->addSkeletonListener(this)); } } }