Plugins/PointSprite/ParaViewPlugin/Qvis/ColorTableAttributes.cpp
bool
ColorTableAttributes::CreateNode(DataNode *parentNode, bool, bool)
{
    if(parentNode == 0)
        return true;

    // Create a node for ColorTableAttributes.
    DataNode *node = new DataNode("ColorTableAttributes");
    node->AddNode(new DataNode("activeContinuous", activeContinuous));
    node->AddNode(new DataNode("activeDiscrete", activeDiscrete));

    // Add each color table specially.
    char tmp[100];
    ColorControlPointList defaultObject;
    int index = 0;
    for(unsigned int i = 0; i < colorTables.size(); ++i)    
    {
        const ColorControlPointList &ccpl = GetColorTables(i);
        if(!ccpl.GetExternalFlag())
        {
            SNPRINTF(tmp, 100, "table%02d", index++);
            DataNode *ctNode = new DataNode(tmp);
            // Add the color table attributes to the ctNode.
            ctNode->AddNode(new DataNode("ctName", names[i]));
            if(!ccpl.FieldsEqual(1, &defaultObject))
                ctNode->AddNode(new DataNode("equal", ccpl.GetEqualSpacingFlag()));
            if(!ccpl.FieldsEqual(2, &defaultObject))
                ctNode->AddNode(new DataNode("smooth", ccpl.GetSmoothingFlag()));
            if(!ccpl.FieldsEqual(3, &defaultObject))
                ctNode->AddNode(new DataNode("discrete", ccpl.GetDiscreteFlag()));

            // Add the control points to the vector that we'll save out.
            floatVector fvec;
            for(int j = 0; j < ccpl.GetNumControlPoints(); ++j)
            {
                const ColorControlPoint &cp = ccpl.operator[](j);
                fvec.push_back(cp.GetPosition());
                fvec.push_back(float(cp.GetColors()[0]));
                fvec.push_back(float(cp.GetColors()[1]));
                fvec.push_back(float(cp.GetColors()[2]));
            }
            ctNode->AddNode(new DataNode("controlPts", fvec));
            node->AddNode(ctNode);
        }
    }

    node->AddNode(new DataNode("Ntables", index));

    // Add the node to the parent node.
    parentNode->AddNode(node);

    return true;
}
// ****************************************************************************
// Method: ColorTableAttributes::CreateNode
//
// Purpose: 
//   This method creates a DataNode representation of the object so it can be saved to a config file.
//
// Note:       Autogenerated by classwriter.
//
// Programmer: classwriter
// Creation:   Mon Jun 11 10:41:36 PDT 2001
//
// Modifications:
//   Brad Whitlock, Mon Jun 18 22:03:23 PST 2001
//   Custom coded this method since classwriter's resulting output format
//   was ridiculous.
//
//   Brad Whitlock, Wed Nov 20 12:24:43 PDT 2002
//   I made it work with discrete colortables.
//
//   Brad Whitlock, Tue May 20 10:21:14 PDT 2003
//   I made it saved out only what needs to be saved out.
//
//   Brad Whitlock, Mon Jul 7 16:51:05 PST 2003
//   I prevented it from saving out colortables that are external.
//
//   Brad Whitlock, Wed Dec 17 12:21:24 PDT 2003
//   I added another bool argument.
//
//   Brad Whitlock, Tue Mar 13 10:40:04 PDT 2007
//   Updated due to code generator changes.
//
// ****************************************************************************
:CreateNode
Purpose:
This method creates a DataNode representation of the object so it can be saved to a config file.

Autogenerated by classwriter.

classwriter
Creation:   Mon Jun 11 10:41:36 PDT 2001

Brad Whitlock, Mon Jun 18 22:03:23 PST 2001
Custom coded this method since classwriter's resulting output format
was ridiculous.

Brad Whitlock, Wed Nov 20 12:24:43 PDT 2002
I made it work with discrete colortables.

Brad Whitlock, Tue May 20 10:21:14 PDT 2003
I made it saved out only what needs to be saved out.

Brad Whitlock, Mon Jul 7 16:51:05 PST 2003
I prevented it from saving out colortables that are external.

Brad Whitlock, Wed Dec 17 12:21:24 PDT 2003
I added another bool argument.

Brad Whitlock, Tue Mar 13 10:40:04 PDT 2007
Updated due to code generator changes.
: CreateNode Purpose : This method creates a DataNode representation of the object so it can be saved to a config file . Autogenerated by classwriter . classwriter Creation : Mon Jun 11 10 : 41 : 36 PDT 2001 Brad Whitlock Mon Jun 18 22 : 03 : 23 PST 2001 Custom coded this method since classwriter ' s resulting output format was ridiculous . Brad Whitlock Wed Nov 20 12 : 24 : 43 PDT 2002 I made it work with discrete colortables . Brad Whitlock Tue May 20 10 : 21 : 14 PDT 2003 I made it saved out only what needs to be saved out . Brad Whitlock Mon Jul 7 16 : 51 : 05 PST 2003 I prevented it from saving out colortables that are external . Brad Whitlock Wed Dec 17 12 : 21 : 24 PDT 2003 I added another bool argument . Brad Whitlock Tue Mar 13 10 : 40 : 04 PDT 2007 Updated due to code generator changes .
bool
ColorTableAttributes::CreateNode(DataNode *parentNode, bool, bool)
{
    if(parentNode == 0)
        return true;
    DataNode *node = new DataNode("ColorTableAttributes");
    node->AddNode(new DataNode("activeContinuous", activeContinuous));
    node->AddNode(new DataNode("activeDiscrete", activeDiscrete));
    char tmp[100];
    ColorControlPointList defaultObject;
    int index = 0;
    for(unsigned int i = 0; i < colorTables.size(); ++i)    
    {
        const ColorControlPointList &ccpl = GetColorTables(i);
        if(!ccpl.GetExternalFlag())
        {
            SNPRINTF(tmp, 100, "table%02d", index++);
            DataNode *ctNode = new DataNode(tmp);
            ctNode->AddNode(new DataNode("ctName", names[i]));
            if(!ccpl.FieldsEqual(1, &defaultObject))
                ctNode->AddNode(new DataNode("equal", ccpl.GetEqualSpacingFlag()));
            if(!ccpl.FieldsEqual(2, &defaultObject))
                ctNode->AddNode(new DataNode("smooth", ccpl.GetSmoothingFlag()));
            if(!ccpl.FieldsEqual(3, &defaultObject))
                ctNode->AddNode(new DataNode("discrete", ccpl.GetDiscreteFlag()));
            floatVector fvec;
            for(int j = 0; j < ccpl.GetNumControlPoints(); ++j)
            {
                const ColorControlPoint &cp = ccpl.operator[](j);
                fvec.push_back(cp.GetPosition());
                fvec.push_back(float(cp.GetColors()[0]));
                fvec.push_back(float(cp.GetColors()[1]));
                fvec.push_back(float(cp.GetColors()[2]));
            }
            ctNode->AddNode(new DataNode("controlPts", fvec));
            node->AddNode(ctNode);
        }
    }
    node->AddNode(new DataNode("Ntables", index));
    parentNode->AddNode(node);
    return true;
}
bool ColorTableAttributes :: CreateNode ( DataNode * parentNode , bool , bool ) { if ( parentNode == 0 ) return true ; DataNode * node = new DataNode ( " " ) ; node -> AddNode ( new DataNode ( " " , activeContinuous ) ) ; node -> AddNode ( new DataNode ( " " , activeDiscrete ) ) ; char tmp [ 100 ] ; ColorControlPointList defaultObject ; int index = 0 ; for ( unsigned int i = 0 ; i < colorTables . size ( ) ; ++ i ) { const ColorControlPointList & ccpl = GetColorTables ( i ) ; if ( ! ccpl . GetExternalFlag ( ) ) { SNPRINTF ( tmp , 100 , " " , index ++ ) ; DataNode * ctNode = new DataNode ( tmp ) ; ctNode -> AddNode ( new DataNode ( " " , names [ i ] ) ) ; if ( ! ccpl . FieldsEqual ( 1 , & defaultObject ) ) ctNode -> AddNode ( new DataNode ( " " , ccpl . GetEqualSpacingFlag ( ) ) ) ; if ( ! ccpl . FieldsEqual ( 2 , & defaultObject ) ) ctNode -> AddNode ( new DataNode ( " " , ccpl . GetSmoothingFlag ( ) ) ) ; if ( ! ccpl . FieldsEqual ( 3 , & defaultObject ) ) ctNode -> AddNode ( new DataNode ( " " , ccpl . GetDiscreteFlag ( ) ) ) ; floatVector fvec ; for ( int j = 0 ; j < ccpl . GetNumControlPoints ( ) ; ++ j ) { const ColorControlPoint & cp = ccpl . operator [ ] ( j ) ; fvec . push_back ( cp . GetPosition ( ) ) ; fvec . push_back ( float ( cp . GetColors ( ) [ 0 ] ) ) ; fvec . push_back ( float ( cp . GetColors ( ) [ 1 ] ) ) ; fvec . push_back ( float ( cp . GetColors ( ) [ 2 ] ) ) ; } ctNode -> AddNode ( new DataNode ( " " , fvec ) ) ; node -> AddNode ( ctNode ) ; } } node -> AddNode ( new DataNode ( " " , index ) ) ; parentNode -> AddNode ( node ) ; return true ; }
Method: ColorTableAttributes::CreateNode
Purpose:
This method creates a DataNode representation of the object so it can be saved to a config file.
Method : ColorTableAttributes :: CreateNode Purpose : This method creates a DataNode representation of the object so it can be saved to a config file .
// Create a node for ColorTableAttributes. // Add each color table specially. // Add the color table attributes to the ctNode. // Add the control points to the vector that we'll save out. // Add the node to the parent node.