예제 #1
0
/*virtual*/
void Marker::updateFromXMLNode(SimTK::Xml::Element& aNode, int versionNumber)
{

    if (versionNumber < XMLDocument::getLatestVersion()){
        if (versionNumber < 30501) {
            // Parse name of Body under <body>node
            SimTK::Xml::element_iterator bIter = aNode.element_begin("body");
            SimTK::String bName = bIter->getValue();
            // Create nodes for new layout
            SimTK::Xml::Element connectorsElement("connectors");
            SimTK::Xml::Element frameElement("Connector_PhysicalFrame_");
            connectorsElement.insertNodeAfter(connectorsElement.node_end(), frameElement);
            frameElement.setAttributeValue("name", "parent_frame");
            SimTK::Xml::Element connecteeElement("connectee_name");
            // Markers in pre-4.0 models are necessarily 1 level deep
            // (model, markers), and Bodies were necessarily 1 level deep;
            // here we create the correct relative path (accounting for sets
            // being components).
            bName = XMLDocument::updateConnecteePath30517("bodyset", bName);
            connecteeElement.setValue(bName);
            frameElement.insertNodeAfter(frameElement.node_end(), connecteeElement);
            aNode.insertNodeAfter(bIter, connectorsElement);
            aNode.eraseNode(bIter);
        }
    }
    // Call base class now assuming _node has been corrected for current version
    Super::updateFromXMLNode(aNode, versionNumber);
}
예제 #2
0
/*virtual*/
void Marker::updateFromXMLNode(SimTK::Xml::Element& aNode, int versionNumber)
{

    if (versionNumber < XMLDocument::getLatestVersion()){
        if (versionNumber < 30501) {
            // Parse name of Body under <body>node
            SimTK::Xml::element_iterator bIter = aNode.element_begin("body");
            SimTK::String bName = bIter->getValue();
            // Create nodes for new layout
            SimTK::Xml::Element connectorsElement("connectors");
            SimTK::Xml::Element frameElement("Connector_PhysicalFrame_");
            connectorsElement.insertNodeAfter(connectorsElement.node_end(), frameElement);
            frameElement.setAttributeValue("name", "reference_frame");
            SimTK::Xml::Element connecteeElement("connectee_name");
            connecteeElement.setValue(bName);
            frameElement.insertNodeAfter(frameElement.node_end(), connecteeElement);
            aNode.insertNodeAfter(bIter, connectorsElement);
            aNode.eraseNode(bIter);
        }
    }
    // Call base class now assuming _node has been corrected for current version
    Object::updateFromXMLNode(aNode, versionNumber);
}