Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages | Examples

ObjectNode.cpp

#include "whiptk/whip_toolkit.h"

extern WT_File whip_file; //Assume this has been opened for writing elsewhere.

WT_Result ObjectNode()
{
    //Store the current object node.
    WT_Object_Node current_node = whip_file.desired_rendition().object_node();
    //Define some polylines.
    int x=0,y=0;
    WT_Logical_Point vP[4];
    vP[0] = WT_Logical_Point(x,y);
    vP[1] = WT_Logical_Point(x+50,y);
    vP[2] = WT_Logical_Point(x,y+100);
    vP[3] = WT_Logical_Point(x+50,y+100);
    vP[4] = WT_Logical_Point(x,y+200);
    vP[5] = WT_Logical_Point(x+50,y+200);
    //Create the polylines.
    WT_Polyline p1 (2, vP, WD_True);
    WT_Polyline p2 (2, &vP[2], WD_True);
    WT_Polyline p3 (2, &vP[4], WD_True);
    //Serialize line 1, associated with node 1.
    whip_file.desired_rendition().object_node() = WT_Object_Node(whip_file, 1, "Node 1");
    WD_CHECK(p1.serialize (whip_file));
    //Serialize line 2, associated with node 2.
    whip_file.desired_rendition().object_node() = WT_Object_Node(whip_file, 2, "Node 2");
    WD_CHECK(p2.serialize (whip_file));
    //Serialize line 3, associated with node 1 (no need to specify the name again.)
    whip_file.desired_rendition().object_node() = WT_Object_Node(whip_file, 1);
    WD_CHECK(p3.serialize (whip_file));
    //Restore the saved object node.
    whip_file.desired_rendition().object_node() = current_node;

    return WT_Result::Success;
}

Generated on Mon May 9 23:00:10 2005 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.1