1 /***********************************************************************/ 2 /* Open Visualization Data Explorer */ 3 /* (C) Copyright IBM Corp. 1989,1999 */ 4 /* ALL RIGHTS RESERVED */ 5 /* This code licensed under the */ 6 /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */ 7 /***********************************************************************/ 8 /* 9 * $Header: /src/master/dx/src/exec/dxmods/_helper_jea.h,v 1.7 2003/07/11 05:50:34 davidt Exp $ 10 */ 11 12 #include <dxconfig.h> 13 14 15 #ifndef __HELPER_JEA_H_ 16 #define __HELPER_JEA_H_ 17 18 19 #include <dx/dx.h> 20 21 22 #define TRUE 1 23 #define FALSE 0 24 25 26 #if !defined(intelnt) && !defined(WIN32) 27 typedef int boolean; 28 #endif 29 #if DXD_HAS_LIBIOP 30 #define CAN_HAVE_ARRAY_DASD 1 31 #else 32 #define CAN_HAVE_ARRAY_DASD 0 33 #endif 34 35 #if DXD_HAS_LOCAL_MEMORY 36 #define CAN_HAVE_LOCAL_MEMORY 1 37 #else 38 #define CAN_HAVE_LOCAL_MEMORY 0 39 #endif 40 41 42 #define ErrorGotoPlus1(e,s,a) {DXSetError(e,s,a); goto error;} 43 #define ErrorGotoPlus2(e,s,a,b) {DXSetError(e,s,a,b); goto error;} 44 #define ErrorGotoPlus3(e,s,a,b,c) {DXSetError(e,s,a,b,c); goto error;} 45 46 47 typedef enum 48 { 49 /* Placeholder for "No Such Component" */ 50 NULL_COMP = -1, 51 52 POSITIONS_2D_COMP = 0, 53 POSITIONS_3D_COMP = 1, 54 POINT_DATA_COMP = 2, 55 POINT_COLORS_COMP = 3, 56 POINT_NORMALS_COMP = 4, 57 TETRA_NEIGHBORS_COMP = 5, 58 CUBE_NEIGHBORS_COMP = 6, 59 60 /* required that *_CONNECTIONS_COMP elements be contiguous */ 61 LINE_CONNECTIONS_COMP = 7, 62 QUAD_CONNECTIONS_COMP = 8, 63 TRIANGLE_CONNECTIONS_COMP = 9, 64 CUBE_CONNECTIONS_COMP = 10, 65 TETRA_CONNECTIONS_COMP = 11 66 67 #if 0 68 /* These are not yet implemented anywhere in SVS */ 69 , 70 QUAD_NEIGHBORS_COMP = 99, 71 TRIANGLE_NEIGHBORS_COMP = 99, 72 FACE_CONNECTIONS_COMP = 99, 73 LOOP_CONNECTIONS_COMP = 99, 74 EDGE_CONNECTIONS_COMP = 99 75 #endif 76 77 } Component_Type; 78 79 /* 80 * The position of operation refers to location with respect to start, 81 * so *_pos(*_first) will always be 0 82 * and specifically *_pos(*_last) == *_size - 1 83 * ...which is perfect for 'c' language. 84 */ 85 86 #define Component_Type_first POSITIONS_2D_COMP 87 #define Component_Type_last TETRA_CONNECTIONS_COMP 88 #define Component_Type_pos(a) \ 89 ( (int)(a) - (int)Component_Type_first ) 90 #define Component_Type_size \ 91 ( (int)Component_Type_last + 1 - (int)Component_Type_first ) 92 93 #define Connective_Component_Type_first LINE_CONNECTIONS_COMP 94 #define Connective_Component_Type_last TETRA_CONNECTIONS_COMP 95 #define Connective_Component_Type_pos(a) \ 96 ( (int)(a) - (int)Connective_Component_Type_first ) 97 #define Connective_Component_Type_size \ 98 ( (int)Connective_Component_Type_last + 1 - \ 99 (int)Connective_Component_Type_first ) 100 101 char * _dxf_ClassName ( Class class ); 102 103 Pointer _dxf_AllocateBestLocal ( unsigned int n ); 104 105 Pointer _dxf_ReAllocateBest ( Pointer p, unsigned int n ); 106 107 108 /* Last three arguments for next two calls are optional */ 109 Array _dxf_NewComponentArray ( Component_Type comp_type, 110 int *count, 111 Pointer origin, 112 Pointer delta ); 113 114 Error _dxf_GetComponentData ( Object in_object, 115 Component_Type comp_type, 116 int *count, 117 Pointer origin, 118 Pointer delta, 119 Pointer *ptr ); 120 121 int _dxf_greater_prime ( int ); 122 123 Error _dxf_ValidImageField ( Field image ); 124 /** 125 \index{_dxf_ValidImageField} 126 Returns {\tt OK} if {\tt image} is a Field class object 127 compatible for image operations, or else returns {\tt NULL}. 128 **/ 129 130 131 Field _dxf_CheckImage ( Field image ); 132 Error _dxf_CountImages ( Object image, int *count ); 133 134 /* Get AND Check that they match across groups */ 135 Error _dxf_GetImageDeltas ( Object image, float *deltas ); 136 137 138 /* Check for acceptability: std. image or transposed. */ 139 Error _dxf_CheckImageDeltas ( Object image, int *transposed ); 140 141 Field _dxf_SetImageOrigin ( Field image, int xorigin, int yorigin ); 142 /** 143 \index{_dxf_SetImageOrigin} 144 Sets the origin of {\tt image} to be that of the values of {\tt xorigin} 145 and {\tt yorigin}. 146 Returns {\tt OK} upon successful completion, or if there is an error, 147 sets the Error Code and returns {\tt ERROR}. 148 **/ 149 150 CompositeField _dxf_SetCompositeImageOrigin 151 ( CompositeField image, int xorigin, int yorigin ); 152 /** 153 \index{_dxf_SetCompositeImageOrigin} 154 Sets the origin of CompositeField image {\tt image} to be that of 155 {\tt xorigin} and {\tt yorigin}. 156 Returns pointer to {\tt image} upon success or if there is an error, 157 sets the Error Code and returns {\tt ERROR}. 158 **/ 159 160 161 Field _dxf_SimplifyCompositeImage ( CompositeField image ); 162 /** 163 \index{_dxf_SimplifyCompositeImage} 164 Takes the pixel contents of CompositeField {\tt image} and simplifies 165 them to be a simple Field object. 166 Returns pointer to the constructed Field upon successful completion, 167 or if there is an error, sets the Error Code and returns {\tt ERROR}. 168 **/ 169 170 171 /* 172 * for 'infield', calculate and set a "fuzz" component. 173 * 'type' values progress as follows: 174 * 1 for connections 175 * 2 for positions 176 */ 177 Field _dxf_SetFuzzAttribute ( Field infield, int type ); 178 179 #define VALUE_UNSPECIFIED -1 180 181 typedef struct sizedata 182 { 183 int height; 184 int width; 185 int startframe; 186 int endframe; 187 } 188 SizeData; 189 190 191 Array _dxf_CopyArray_jea ( Array in, enum _dxd_copy copy ); 192 193 Field _dxf_GetEnumeratedImage ( Object o, int n ); 194 195 SizeData * _dxf_GetImageAttributes ( Object o, SizeData *sd ); 196 197 198 /********************************************************************\ 199 * _dxf_OutputX and OutputGL reside in separate files, not _helper_jea.c * 200 * _dxf_OutputX will likely be integrated into libsvs * 201 * OutputGL will likely be deleted * 202 \********************************************************************/ 203 204 Field _dxf_MakeFieldEmpty ( Field infield ); 205 206 207 208 /* 209 * If a color is not in place, create a regular one with the setting specified. 210 */ 211 Field _dxf_SetDefaultColor ( Field input, RGBColor color ); 212 213 214 Error _dxf_OutputX ( Object image, char *XServerName, int XWindowID ); 215 /** 216 \index{_dxf_OutputX} 217 Display {\tt image} on optional 'X' windows server {\tt XServerName}. 218 If {\tt XWindowID} is nonzero, then use a window that has already been 219 created, perhaps by another application. 220 Returns {\tt OK} upon successful completion, or if there is an error, 221 sets the Error Code and returns {\tt ERROR}. 222 **/ 223 224 225 /* calls operating on either nonspecific group or Series group */ 226 227 /* 228 * Turns nested CompositeFields into single level ones. 229 * Turns a Field into a Field (for callers convenience). 230 */ 231 Object _dxf_FlattenHierarchy ( Object in ); 232 233 Group _dxf_SetMember_G_S ( Group g, int n, char *name, float position, Object o ); 234 235 Object _dxf_GetEnumeratedMember_G_S ( Group g, int n, char **name, float *position ); 236 237 238 #endif /* __HELPER_JEA_H_ */ 239 240 241 242