WhipExamples/ContourSet.cpp

00001 //
00002 //  Copyright (c) 2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED,
00008 //  AS TO THE CORRECTNESS OF THIS CODE OR ANY DERIVATIVE
00009 //  WORKS WHICH INCORPORATE IT.
00010 //
00011 //  AUTODESK PROVIDES THE CODE ON AN "AS-IS" BASIS
00012 //  AND EXPLICITLY DISCLAIMS ANY LIABILITY, INCLUDING
00013 //  CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00014 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00015 //
00016 //  Use, duplication, or disclosure by the U.S. Government is subject to
00017 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00018 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00019 //  Data and Computer Software), as applicable.
00020 //
00021 
00022 #include "whiptk/whip_toolkit.h"
00023 #include "whiptk/w2d_class_factory.h"
00024 
00025 extern WT_File *whip_file; //Assume this has been opened for writing elsewhere.
00026 
00027 //Creates a diamond with a hole containing another interior diamond.
00028 WT_Result ContourSet()
00029 {
00030     WT_W2D_Class_Factory cf;
00031 
00032     //Define the contour coordinates
00033     int x=0,y=0;
00034     WT_Logical_Point diamonds[12]; 
00035     diamonds[0] = WT_Logical_Point(x, y+200); //positive space (winds clockwise)
00036     diamonds[1] = WT_Logical_Point(x+200, y); 
00037     diamonds[2] = WT_Logical_Point(x, y-200);
00038     diamonds[3] = WT_Logical_Point(x-200, y);
00039     diamonds[4] = WT_Logical_Point(x, y+150); //negative space (winds counterclockwise)
00040     diamonds[5] = WT_Logical_Point(x-150, y);
00041     diamonds[6] = WT_Logical_Point(x, y-150);
00042     diamonds[7] = WT_Logical_Point(x+150, y); 
00043     diamonds[8] = WT_Logical_Point(x, y+100); //positive space (winds clockwise)
00044     diamonds[9] = WT_Logical_Point(x+100, y); 
00045     diamonds[10] = WT_Logical_Point(x, y-100);
00046     diamonds[11] = WT_Logical_Point(x-100, y);
00047     //Define the number of points per contour (3 contours, 4 points each).
00048     WT_Integer32 contour_counts[3] = {4,4,4};
00049     //Create the contour set.
00050     WT_Contour_Set* diamond_contour = cf.Create_Contour_Set(*whip_file, 3, contour_counts, 12, diamonds, WD_True);
00051     if (diamond_contour == NULL)
00052         return WT_Result::Out_Of_Memory_Error;
00053     //Serialize it.
00054     WD_CHECK(diamond_contour->serialize(*whip_file));
00055 
00056     cf.Destroy(diamond_contour);
00057     return WT_Result::Success;
00058 }

Generated on Tue Jan 6 22:40:01 2009 for Autodesk DWF Toolkit by  doxygen 1.4.5