void
AnnotationObject::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

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

    DataNode *node;
    if((node = searchNode->GetNode("objectName")) != 0)
        SetObjectName(node->AsString());
    if((node = searchNode->GetNode("objectType")) != 0)
    {
        // Allow enums to be int or string in the config file
        if(node->GetNodeType() == INT_NODE)
        {
            int ival = node->AsInt();
            if(ival >= 0 && ival < 8)
                SetObjectType(AnnotationType(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            AnnotationType value;
            if(AnnotationType_FromString(node->AsString(), value))
                SetObjectType(value);
        }
    }
    if((node = searchNode->GetNode("visible")) != 0)
        SetVisible(node->AsBool());
    if((node = searchNode->GetNode("active")) != 0)
        SetActive(node->AsBool());
    if((node = searchNode->GetNode("position")) != 0)
    {
        if(node->GetNodeType() == FLOAT_ARRAY_NODE)
        {
            const float *fn = node->AsFloatArray();
            double dp[3] = {fn[0], fn[1], fn[2]};
            SetPosition(dp);
        }
        else
            SetPosition(node->AsDoubleArray());
    }
    if((node = searchNode->GetNode("position2")) != 0)
    {
        if(node->GetNodeType() == FLOAT_ARRAY_NODE)
        {
            const float *fn = node->AsFloatArray();
            double dp[3] = {fn[0], fn[1], fn[2]};
            SetPosition2(dp);
        }
        else
            SetPosition2(node->AsDoubleArray());
    }
    if((node = searchNode->GetNode("textColor")) != 0)
        textColor.SetFromNode(node);
    if((node = searchNode->GetNode("useForegroundForTextColor")) != 0)
        SetUseForegroundForTextColor(node->AsBool());
    if((node = searchNode->GetNode("color1")) != 0)
        color1.SetFromNode(node);
    if((node = searchNode->GetNode("color2")) != 0)
        color2.SetFromNode(node);
    if((node = searchNode->GetNode("text")) != 0)
        SetText(node->AsStringVector());
    if((node = searchNode->GetNode("fontFamily")) != 0)
    {
        // Allow enums to be int or string in the config file
        if(node->GetNodeType() == INT_NODE)
        {
            int ival = node->AsInt();
            if(ival >= 0 && ival < 3)
                SetFontFamily(FontFamily(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            FontFamily value;
            if(FontFamily_FromString(node->AsString(), value))
                SetFontFamily(value);
        }
    }
    if((node = searchNode->GetNode("fontBold")) != 0)
        SetFontBold(node->AsBool());
    if((node = searchNode->GetNode("fontItalic")) != 0)
        SetFontItalic(node->AsBool());
    if((node = searchNode->GetNode("fontShadow")) != 0)
        SetFontShadow(node->AsBool());
    if((node = searchNode->GetNode("floatAttribute1")) != 0)
        SetDoubleAttribute1(node->AsDouble());
    if((node = searchNode->GetNode("doubleAttribute1")) != 0)
        SetDoubleAttribute1(node->AsDouble());
    if((node = searchNode->GetNode("intAttribute1")) != 0)
        SetIntAttribute1(node->AsInt());
    if((node = searchNode->GetNode("intAttribute2")) != 0)
        SetIntAttribute2(node->AsInt());
    if((node = searchNode->GetNode("intAttribute3")) != 0)
        SetIntAttribute3(node->AsInt());
    if((node = searchNode->GetNode("doubleVector1")) != 0)
        SetDoubleVector1(node->AsDoubleVector());
    if((node = searchNode->GetNode("stringVector1")) != 0)
        SetStringVector1(node->AsStringVector());
    if((node = searchNode->GetNode("stringVector2")) != 0)
        SetStringVector2(node->AsStringVector());
}
void
SimilarityTransformAttributes::SetFromNode(DataNode *parentNode)
{
    if(parentNode == 0)
        return;

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

    DataNode *node;
    if((node = searchNode->GetNode("doRotate")) != 0)
        SetDoRotate(node->AsBool());
    if((node = searchNode->GetNode("rotateOrigin")) != 0)
    {
        if(node->GetNodeType() == DOUBLE_ARRAY_NODE)
        {
            SetRotateOrigin(node->AsDoubleArray());
        }
        else if(node->GetNodeType() == FLOAT_ARRAY_NODE)
        {
            const float *fa = node->AsFloatArray();
            double da[3] = {fa[0], fa[1], fa[2]};
            SetRotateOrigin(da);
        }
    }
    if((node = searchNode->GetNode("rotateAxis")) != 0)
    {
        if(node->GetNodeType() == DOUBLE_ARRAY_NODE)
        {
            SetRotateAxis(node->AsDoubleArray());
        }
        else if(node->GetNodeType() == FLOAT_ARRAY_NODE)
        {
            const float *fa = node->AsFloatArray();
            double da[3] = {fa[0], fa[1], fa[2]};
            SetRotateAxis(da);
        }
    }
    if((node = searchNode->GetNode("rotateAmount")) != 0)
    {
        if(node->GetNodeType() == DOUBLE_NODE)
            SetRotateAmount(node->AsDouble());
        else if(node->GetNodeType() == FLOAT_NODE)
            SetRotateAmount((double)node->AsFloat());
    }
    if((node = searchNode->GetNode("rotateType")) != 0)
    {
        // Allow enums to be int or string in the config file
        if(node->GetNodeType() == INT_NODE)
        {
            int ival = node->AsInt();
            if(ival >= 0 && ival < 2)
                SetRotateType(AngleType(ival));
        }
        else if(node->GetNodeType() == STRING_NODE)
        {
            AngleType value;
            if(AngleType_FromString(node->AsString(), value))
                SetRotateType(value);
        }
    }
    if((node = searchNode->GetNode("doScale")) != 0)
        SetDoScale(node->AsBool());
    if((node = searchNode->GetNode("scaleOrigin")) != 0)
    {
        if(node->GetNodeType() == DOUBLE_ARRAY_NODE)
        {
            SetScaleOrigin(node->AsDoubleArray());
        }
        else if(node->GetNodeType() == FLOAT_ARRAY_NODE)
        {
            const float *fa = node->AsFloatArray();
            double da[3] = {fa[0], fa[1], fa[2]};
            SetScaleOrigin(da);
        }
    }
    if((node = searchNode->GetNode("scaleX")) != 0)
    {
        if(node->GetNodeType() == DOUBLE_NODE)
            SetScaleX(node->AsDouble());
        else if(node->GetNodeType() == FLOAT_NODE)
            SetScaleX((double)node->AsFloat());
    }
    if((node = searchNode->GetNode("scaleY")) != 0)
    {
        if(node->GetNodeType() == DOUBLE_NODE)
            SetScaleY(node->AsDouble());
        else if(node->GetNodeType() == FLOAT_NODE)
            SetScaleY((double)node->AsFloat());
    }
    if((node = searchNode->GetNode("scaleZ")) != 0)
    {
        if(node->GetNodeType() == DOUBLE_NODE)
            SetScaleZ(node->AsDouble());
        else if(node->GetNodeType() == FLOAT_NODE)
            SetScaleZ((double)node->AsFloat());
    }
    if((node = searchNode->GetNode("doTranslate")) != 0)
        SetDoTranslate(node->AsBool());
    if((node = searchNode->GetNode("translateX")) != 0)
    {
        if(node->GetNodeType() == DOUBLE_NODE)
            SetTranslateX(node->AsDouble());
        else if(node->GetNodeType() == FLOAT_NODE)
            SetTranslateX((double)node->AsFloat());
    }
    if((node = searchNode->GetNode("translateY")) != 0)
    {
        if(node->GetNodeType() == DOUBLE_NODE)
            SetTranslateY(node->AsDouble());
        else if(node->GetNodeType() == FLOAT_NODE)
            SetTranslateY((double)node->AsFloat());
    }
    if((node = searchNode->GetNode("translateZ")) != 0)
    {
        if(node->GetNodeType() == DOUBLE_NODE)
            SetTranslateZ(node->AsDouble());
        else if(node->GetNodeType() == FLOAT_NODE)
            SetTranslateZ((double)node->AsFloat());
    }
    if((node = searchNode->GetNode("transformVectors")) != 0)
        SetTransformVectors(node->AsBool());
}