/* $XConsortium: pldata1.pi,v 5.2 94/04/17 20:48:48 rws Exp $ */ /***************************************************************** Copyright (c) 1989, 1990, 1991,1990 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. Copyright (c) 1989, 1990, 1991,1990 by Sun Microsystems, Inc. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Sun Microsystems, and the X Consortium, not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ ## pldata1.pi - test ppolyline_set3_data with a few different ## geometries and widths, with vertex data. Combinations tested: ## - set of one single-vertex polyline (not expected to draw) ## - set of one multi-vertex polyline ## - set of two single-vertex polylines (also not expected to draw) ## - set of three polylines, of 3, 1, and 4 vertices tbegintest("pldata1", "POLYLINE_SET3_DATA with simple geometries, widths"); source macro.pi @WINSIZE = 200 @SAMPLESIZE = 200 red_Pgcolr = I_Pgcolr(PMODEL_RGB,1.0,0.0,0.0) # for line color # # data for a few polylines: vertices and RGB colors # pline1 = I_Pline_vdata_list3_from_data(1, PVERT_COORD_COLOUR, PMODEL_RGB, 0.1,0.1,0.0, 0.0,1.0,0.4); pline2 = I_Pline_vdata_list3_from_data(3, PVERT_COORD_COLOUR, PMODEL_RGB, 0.2,0.3,0.0, 1.0,1.0,0.8, 0.5,0.4,0.0, 0.0,0.8,1.0, 0.1,0.4,0.5, 1.0,0.8,1.0) pline4 = I_Pline_vdata_list3_from_data(1, PVERT_COORD_COLOUR, PMODEL_RGB, 0.1,0.9,0.0, 0.0,1.0,0.4); pline5 = I_Pline_vdata_list3_from_data(1, PVERT_COORD_COLOUR, PMODEL_RGB, 0.05,0.95,0.0, 1.0,1.0,0.4); pline6 = I_Pline_vdata_list3_from_data(3, PVERT_COORD_COLOUR, PMODEL_RGB, 0.5,0.6,0.0, 1.0,0.0,0.0, 0.7,0.5,0.0, 1.0,0.8,0.8, 0.9,0.8,0.5, 1.0,0.8,0.8) pline7 = I_Pline_vdata_list3_from_data(1, PVERT_COORD_COLOUR, PMODEL_RGB, 0.9,0.9,0.0, 1.0,1.0,1.0); pline8 = I_Pline_vdata_list3_from_data(4, PVERT_COORD_COLOUR, PMODEL_RGB, 0.6,0.8,0.1, 0.0,1.0,0.0, 0.7,0.7,0.3, 0.9,1.0,0.5, 0.9,0.9,0.2, 0.9,1.0,1.0, 0.8,0.6,0.1, 0.9,1.0,0.9); # points for a basic ppolyline3: polypoints = IA_Ppoint3(4, 0.6,0.2,0.1, 0.7,0.1,0.3, 0.9,0.4,0.2, 0.8,0.1,0.1) polylist = I_Ppoint_list3(4, polypoints); # data for case 1: set of one single-vertex polyline # (lower left) set1 = IA_Pline_vdata_list3(1, pline1); # data for case 2: set of one multi-vertex polyline # (lower left) set2 = IA_Pline_vdata_list3(1, pline2); # data for case 3: set of two single_vertex polylines # (upper left) set3 = IA_Pline_vdata_list3(2, pline4,pline5); # data for case 4: set of three polylines, with 3, 1, and 4 vertices # (upper right) set4 = IA_Pline_vdata_list3(3, pline6, pline7, pline8); imagename = malloc(16); imagetext = malloc(100); # Set up phigs, workstation, and structure i_open_phigs(NULL,PDEF_MEM_SIZE); i_open_x_ws(1, &display, &window, 100, 300, @WINSIZE, @WINSIZE); popen_struct(1); ppost_struct(1,1,1.0); foreach @linewidth @widthname (0.0; "thin"; 17.0; "thick";) pset_linewidth(@linewidth); # case 1 - one single-vertex polyline ppolyline_set3_data(PVERT_COORD_COLOUR, PMODEL_RGB, 1, set1); # case 2 - one multi-vertex polyline ppolyline_set3_data(PVERT_COORD_COLOUR, PMODEL_RGB, 1, set2); # case 3 - two single-vertex polylines ppolyline_set3_data(PVERT_COORD_COLOUR, PMODEL_RGB, 2, set3); # case 4 - three polylines, of 3, 1, and 4 vertices ppolyline_set3_data(PVERT_COORD_COLOUR, PMODEL_RGB, 3, set4); # for comparison: polyline in lower right ppolyline3(&polylist); # compose the image name and description, compare images strcpy(imagename, "pld1"); strcat(imagename, @widthname); strcpy(imagetext, @widthname); strcat(imagetext, " ppolyline_set3_data in lower left, upper right, and polyline in lower right"); i_check_image(imagename,display,window,0,0,@SAMPLESIZE,@SAMPLESIZE, imagetext); i_pause(); # empty the structure pempty_struct(1); end; tendtest();