bool
SubsetAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool forceAdd)
{
    if(parentNode == 0)
        return false;

    SubsetAttributes defaultObject;
    bool addToParent = false;
    // Create a node for SubsetAttributes.
    DataNode *node = new DataNode("SubsetAttributes");

    if(completeSave || !FieldsEqual(ID_colorType, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("colorType", ColoringMethod_ToString(colorType)));
    }

    if(completeSave || !FieldsEqual(ID_colorTableName, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("colorTableName", colorTableName));
    }

    if(completeSave || !FieldsEqual(ID_invertColorTable, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("invertColorTable", invertColorTable));
    }

    if(completeSave || !FieldsEqual(ID_filledFlag, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("filledFlag", filledFlag));
    }

    if(completeSave || !FieldsEqual(ID_legendFlag, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("legendFlag", legendFlag));
    }

    if(completeSave || !FieldsEqual(ID_lineStyle, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("lineStyle", lineStyle));
    }

    if(completeSave || !FieldsEqual(ID_lineWidth, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("lineWidth", lineWidth));
    }

        DataNode *singleColorNode = new DataNode("singleColor");
        if(singleColor.CreateNode(singleColorNode, completeSave, true))
        {
            addToParent = true;
            node->AddNode(singleColorNode);
        }
        else
            delete singleColorNode;
    if(completeSave || !FieldsEqual(ID_multiColor, &defaultObject))
    {
        DataNode *multiColorNode = new DataNode("multiColor");
        if(multiColor.CreateNode(multiColorNode, completeSave, false))
        {
            addToParent = true;
            node->AddNode(multiColorNode);
        }
        else
            delete multiColorNode;
    }

    if(completeSave || !FieldsEqual(ID_subsetNames, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("subsetNames", subsetNames));
    }

    if(completeSave || !FieldsEqual(ID_subsetType, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("subsetType", Subset_Type_ToString(subsetType)));
    }

    if(completeSave || !FieldsEqual(ID_opacity, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("opacity", opacity));
    }

    if(completeSave || !FieldsEqual(ID_wireframe, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("wireframe", wireframe));
    }

    if(completeSave || !FieldsEqual(ID_drawInternal, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("drawInternal", drawInternal));
    }

    if(completeSave || !FieldsEqual(ID_smoothingLevel, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("smoothingLevel", smoothingLevel));
    }

    if(completeSave || !FieldsEqual(ID_pointSize, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("pointSize", pointSize));
    }

    if(completeSave || !FieldsEqual(ID_pointType, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("pointType", PointType_ToString(pointType)));
    }

    if(completeSave || !FieldsEqual(ID_pointSizeVarEnabled, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("pointSizeVarEnabled", pointSizeVarEnabled));
    }

    if(completeSave || !FieldsEqual(ID_pointSizeVar, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("pointSizeVar", pointSizeVar));
    }

    if(completeSave || !FieldsEqual(ID_pointSizePixels, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("pointSizePixels", pointSizePixels));
    }


    // Add the node to the parent node.
    if(addToParent || forceAdd)
        parentNode->AddNode(node);
    else
        delete node;

    return (addToParent || forceAdd);
}
// ****************************************************************************
// Method: ContourAttributes::CreateNode
//
// Purpose: 
//   This method creates a DataNode representation of the object so it can be saved to a config file.
//
// Note:       Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:   Tue Dec 3 08:50:34 PDT 2002
//
// Modifications:
//   Brad Whitlock, Thu Oct 9 13:32:13 PST 2003
//   I made the single color always be saved out.
//
//   Brad Whitlock, Tue Oct 21 16:01:40 PST 2003
//   I made the default palette get saved out with the colors from the
//   multicolor in it.
//
//   Brad Whitlock, Thu Dec 18 11:52:04 PDT 2003
//   Added the completeSave flag.
//
// ****************************************************************************
bool
ContourAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool forceAdd)
{
    if(parentNode == 0)
        return false;

    ContourAttributes defaultObject;
    bool addToParent = false;
    // Create a node for ContourAttributes.
    DataNode *node = new DataNode("ContourAttributes");

    //
    // Create a copy of the defaultPalette object and store the colors
    // from the multiColor into it. Once we do that, save the palette to
    // the node.
    //
    bool fixupPositions = false;
    DataNode *defaultPaletteNode = new DataNode("defaultPalette");
    ColorControlPointList savePalette(defaultPalette);
    int initialNPoints = savePalette.GetNumControlPoints();
    for(int i = 0; i < multiColor.GetNumColors(); ++i)
    {
        const ColorAttribute &cpt = multiColor.GetColors(i);

        if(i < initialNPoints)
        {
            savePalette[i].SetColors(cpt.GetColor());
        }
        else
        {
            ColorControlPoint ccpt;
            ccpt.SetColors(cpt.GetColor());
            savePalette.AddControlPoints(ccpt);
            fixupPositions = true;
        }
    }
    if(fixupPositions)
    {
        int npts = savePalette.GetNumControlPoints();
        for(int i = 0; i < npts; ++i)
            savePalette[i].SetPosition(float(i) / float(npts-1));
    }
    if(savePalette.CompactCreateNode(defaultPaletteNode, completeSave, forceAdd))
    {
        addToParent = true;
        node->AddNode(defaultPaletteNode);
    }
    else
        delete defaultPaletteNode;

    if(completeSave || !FieldsEqual(ID_colorType, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("colorType", ColoringMethod_ToString(colorType)));
    }

    if(completeSave || !FieldsEqual(ID_colorTableName, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("colorTableName", colorTableName));
    }

    if(completeSave || !FieldsEqual(ID_legendFlag, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("legendFlag", legendFlag));
    }

    if(completeSave || !FieldsEqual(ID_lineStyle, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("lineStyle", lineStyle));
    }

    if(completeSave || !FieldsEqual(ID_lineWidth, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("lineWidth", lineWidth));
    }

        DataNode *singleColorNode = new DataNode("singleColor");
        if(singleColor.CreateNode(singleColorNode, true, true))
        {
            addToParent = true;
            node->AddNode(singleColorNode);
        }
        else
            delete singleColorNode;

    if(completeSave || !FieldsEqual(ID_contourNLevels, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("contourNLevels", contourNLevels));
    }

    if(completeSave || !FieldsEqual(ID_contourValue, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("contourValue", contourValue));
    }

    if(completeSave || !FieldsEqual(ID_contourPercent, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("contourPercent", contourPercent));
    }

    if(completeSave || !FieldsEqual(ID_contourMethod, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("contourMethod", Select_by_ToString(contourMethod)));
    }

    if(completeSave || !FieldsEqual(ID_minFlag, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("minFlag", minFlag));
    }

    if(completeSave || !FieldsEqual(ID_maxFlag, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("maxFlag", maxFlag));
    }

    if(completeSave || !FieldsEqual(ID_min, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("min", min));
    }

    if(completeSave || !FieldsEqual(ID_max, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("max", max));
    }

    if(completeSave || !FieldsEqual(ID_scaling, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("scaling", Scaling_ToString(scaling)));
    }

    if(completeSave || !FieldsEqual(ID_wireframe, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("wireframe", wireframe));
    }

    if(completeSave || !FieldsEqual(ID_invertColorTable, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("invertColorTable", invertColorTable));
    }

    // Add the node to the parent node.
    if(addToParent || forceAdd)
        parentNode->AddNode(node);
    else
        delete node;

    return (addToParent || forceAdd);
}
bool
WellBoreAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool forceAdd)
{
    if(parentNode == 0)
        return false;

    WellBoreAttributes defaultObject;
    bool addToParent = false;
    // Create a node for WellBoreAttributes.
    DataNode *node = new DataNode("WellBoreAttributes");

    if(completeSave || !FieldsEqual(ID_defaultPalette, &defaultObject))
    {
        DataNode *defaultPaletteNode = new DataNode("defaultPalette");
        if(defaultPalette.CreateNode(defaultPaletteNode, completeSave, false))
        {
            addToParent = true;
            node->AddNode(defaultPaletteNode);
        }
        else
            delete defaultPaletteNode;
    }

    if(completeSave || !FieldsEqual(ID_changedColors, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("changedColors", changedColors));
    }

    if(completeSave || !FieldsEqual(ID_colorType, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("colorType", ColoringMethod_ToString(colorType)));
    }

    if(completeSave || !FieldsEqual(ID_colorTableName, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("colorTableName", colorTableName));
    }

    if(completeSave || !FieldsEqual(ID_invertColorTable, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("invertColorTable", invertColorTable));
    }

        DataNode *singleColorNode = new DataNode("singleColor");
        if(singleColor.CreateNode(singleColorNode, completeSave, true))
        {
            addToParent = true;
            node->AddNode(singleColorNode);
        }
        else
            delete singleColorNode;
    if(completeSave || !FieldsEqual(ID_multiColor, &defaultObject))
    {
        DataNode *multiColorNode = new DataNode("multiColor");
        if(multiColor.CreateNode(multiColorNode, completeSave, false))
        {
            addToParent = true;
            node->AddNode(multiColorNode);
        }
        else
            delete multiColorNode;
    }

    if(completeSave || !FieldsEqual(ID_drawWellsAs, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("drawWellsAs", WellRenderingMode_ToString(drawWellsAs)));
    }

    if(completeSave || !FieldsEqual(ID_wellCylinderQuality, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("wellCylinderQuality", DetailLevel_ToString(wellCylinderQuality)));
    }

    if(completeSave || !FieldsEqual(ID_wellRadius, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("wellRadius", wellRadius));
    }

    if(completeSave || !FieldsEqual(ID_wellLineWidth, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("wellLineWidth", wellLineWidth));
    }

    if(completeSave || !FieldsEqual(ID_wellLineStyle, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("wellLineStyle", wellLineStyle));
    }

    if(completeSave || !FieldsEqual(ID_wellAnnotation, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("wellAnnotation", WellAnnotation_ToString(wellAnnotation)));
    }

    if(completeSave || !FieldsEqual(ID_wellStemHeight, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("wellStemHeight", wellStemHeight));
    }

    if(completeSave || !FieldsEqual(ID_wellNameScale, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("wellNameScale", wellNameScale));
    }

    if(completeSave || !FieldsEqual(ID_legendFlag, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("legendFlag", legendFlag));
    }

    if(completeSave || !FieldsEqual(ID_nWellBores, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("nWellBores", nWellBores));
    }

    if(completeSave || !FieldsEqual(ID_wellBores, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("wellBores", wellBores));
    }

    if(completeSave || !FieldsEqual(ID_wellNames, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("wellNames", wellNames));
    }


    // Add the node to the parent node.
    if(addToParent || forceAdd)
        parentNode->AddNode(node);
    else
        delete node;

    return (addToParent || forceAdd);
}
Example #4
0
bool
MultiCurveAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool forceAdd)
{
    if(parentNode == 0)
        return false;

    MultiCurveAttributes defaultObject;
    bool addToParent = false;
    // Create a node for MultiCurveAttributes.
    DataNode *node = new DataNode("MultiCurveAttributes");

    if(completeSave || !FieldsEqual(ID_defaultPalette, &defaultObject))
    {
        DataNode *defaultPaletteNode = new DataNode("defaultPalette");
        if(defaultPalette.CreateNode(defaultPaletteNode, completeSave, false))
        {
            addToParent = true;
            node->AddNode(defaultPaletteNode);
        }
        else
            delete defaultPaletteNode;
    }

    if(completeSave || !FieldsEqual(ID_changedColors, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("changedColors", changedColors));
    }

    if(completeSave || !FieldsEqual(ID_colorType, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("colorType", ColoringMethod_ToString(colorType)));
    }

        DataNode *singleColorNode = new DataNode("singleColor");
        if(singleColor.CreateNode(singleColorNode, completeSave, true))
        {
            addToParent = true;
            node->AddNode(singleColorNode);
        }
        else
            delete singleColorNode;
    if(completeSave || !FieldsEqual(ID_multiColor, &defaultObject))
    {
        DataNode *multiColorNode = new DataNode("multiColor");
        if(multiColor.CreateNode(multiColorNode, completeSave, false))
        {
            addToParent = true;
            node->AddNode(multiColorNode);
        }
        else
            delete multiColorNode;
    }

    if(completeSave || !FieldsEqual(ID_lineStyle, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("lineStyle", lineStyle));
    }

    if(completeSave || !FieldsEqual(ID_lineWidth, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("lineWidth", lineWidth));
    }

    if(completeSave || !FieldsEqual(ID_yAxisTitleFormat, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("yAxisTitleFormat", yAxisTitleFormat));
    }

    if(completeSave || !FieldsEqual(ID_useYAxisTickSpacing, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("useYAxisTickSpacing", useYAxisTickSpacing));
    }

    if(completeSave || !FieldsEqual(ID_yAxisTickSpacing, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("yAxisTickSpacing", yAxisTickSpacing));
    }

    if(completeSave || !FieldsEqual(ID_displayMarkers, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("displayMarkers", displayMarkers));
    }

    if(completeSave || !FieldsEqual(ID_markerVariable, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("markerVariable", markerVariable));
    }

    if(completeSave || !FieldsEqual(ID_displayIds, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("displayIds", displayIds));
    }

    if(completeSave || !FieldsEqual(ID_idVariable, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("idVariable", idVariable));
    }

    if(completeSave || !FieldsEqual(ID_legendFlag, &defaultObject))
    {
        addToParent = true;
        node->AddNode(new DataNode("legendFlag", legendFlag));
    }


    // Add the node to the parent node.
    if(addToParent || forceAdd)
        parentNode->AddNode(node);
    else
        delete node;

    return (addToParent || forceAdd);
}