コード例 #1
0
// ****************************************************************************
// Method: AnimationAttributes::ProcessOldVersions
//
// Purpose:
//   This method creates modifies a DataNode representation of the object
//   so it conforms to the newest representation of the object, which can
//   can be read back in.
//
// Programmer: Kathleen Bonnell
// Creation:   January 12, 2005
//
// Modifications:
//
// ****************************************************************************
void
AnimationAttributes::ProcessOldVersions(DataNode *parentNode,
                                        const char *configVersion)
{
    if(parentNode == 0)
        return;

    DataNode *searchNode = parentNode->GetNode("AnimationAttributes");
    if(searchNode == 0)
        return;

    DataNode *pcNode = searchNode->GetNode("pipelineCachingMode");
    if (pcNode == 0)
        return;

    if (VersionLessThan(configVersion, "1.1.5"))
        searchNode->RemoveNode("pipelineCachingMode");
}
コード例 #2
0
void
AnnotationObject::ProcessOldVersions(DataNode *parentNode,
    const char *configVersion)
{
    if (!VersionLessThan(configVersion, "2.0.0"))
        return;

    if (parentNode == 0)
        return;

    DataNode * searchNode = parentNode->GetNode("AnnotationObject");
    if (searchNode == 0)
        return;

    DataNode *node = searchNode->GetNode("objectType");
    if (node == 0 || node->AsString() != "LegendAttributes")
    {
        return;
    }

    // what follows if for Legends only
    node = searchNode->GetNode("intAttribute1");
    if (node != 0)
    {
        int n = node->AsInt();

        if ((n & (1 << 2)) != 0) // DrawLabels is set, change it to DrawValues
        {
            n -= 4;   // DrawLabels
            n += 512; // DrawValues
        }
        // other new legend enums, default to on, and sum to 384
        n += 384;
        node->SetInt(n);
    }
    // new numTics attribute, default setting is 5
    node = new DataNode("intAttribute2");
    node->SetInt(5);
    searchNode->AddNode(node);
    node = new DataNode("intAttribute3");
    node->SetInt(0);  // default "Variable" type
    searchNode->AddNode(node);
}