home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Plotting / NXplot3d.3.2 / Source / Plot3DView.h < prev    next >
Encoding:
Text File  |  1994-09-26  |  4.5 KB  |  192 lines

  1. /* Plot3dView.h   Copyright 1992 Steve Ludtke */
  2. #import <3Dkit/N3DCamera.h>
  3.  
  4. #define SS .01        /* symbol size. 1.0 would cause the symbols to be */
  5.             /* as large as the view */
  6. #define MAXSETS 5    /* maximum number of sets, changing this number */
  7.             /* requires IB changes as well */
  8. #define NFN 5        /* currently this is redundant. Number of active */
  9.             /* data sets */
  10. #define TIMESTEP .1    /* Time in sec between updates */
  11.  
  12. #define MAXGRID 250    /* maximum x and y grid components */
  13.  
  14. /* 3d point structure */
  15. typedef struct {
  16.     float x,y,z;
  17. } Point;
  18.  
  19. #define MM_none 0
  20. #define MM_height 1
  21. #define MM_grad    2
  22. #define MM_nextset 3
  23.  
  24. #define OVER_surf    1
  25. #define OVER_base    2
  26. #define OVER_csurf    4
  27.  
  28. #define RF_axis        1
  29. #define RF_backs    2
  30. #define RF_floor    4
  31. #define RF_ticks    8
  32. #define RF_planes    16
  33. #define RF_labels    32
  34. #define RF_persp    64
  35.  
  36. #define F_EQN    1
  37. #define F_DATA    2
  38. #define F_SDATA    3
  39. #define F_DEM    4    /* digital elevation map */
  40.  
  41. /* data set preferences structure (incudes pointer to actual data) */
  42. typedef struct {
  43.     char sym;        /* -1 means don't plot, else 0<=sym<=7 */
  44.     Point *fileData;    /* data from a file, NULL if equation mode */
  45.     Point *data;        /* data to be displayed. In file mode it */
  46.                         /* contains the visible subset of the data */
  47.     Point *Sdata;        /* Spherical data to be displayed (mode 7) */
  48.     RtColor *color;
  49.     short *demData;        /* raw DEM data */
  50.     float demx[3],demy[3],demz[2];    /* dem data limits */
  51.     int demnx,demny;                /* dem mesh size */
  52.     int flag;
  53.     int nfdata;        /* # points in file data */
  54.     int ndata;        /* # points in data */
  55.     int nx,ny;        /* grid points in x and y */
  56.     id expr;        /* points to the Expression (formula eval.) */
  57.     RtColor mapcol[5];
  58.     float alpha;
  59.     unsigned char mapsel[5];
  60.     short mapmode;
  61. } SetPref;
  62.  
  63. /* timer for spinning, etc ... */
  64. DPSTimedEntry timer;
  65. void itstime(DPSTimedEntry entry,double now,id call);
  66.  
  67. @interface Plot3DView:N3DCamera
  68. {
  69. id mode;        /* mouse mode selector */
  70. id controller;        /* points to PControl */
  71. id shape;            /* shape containing 3d plot */
  72. id ambLight;
  73. id aLight;
  74. id varT;        /* variable text matrix */
  75. id flagSel;
  76. id autotick;    /* flag for automatic tick spacing generation */
  77. id tickpos;        /* matrix of tick values */
  78. id axisTitle;    /* matrix of axis titles */ 
  79. id aspectS;
  80. id fontSize;    /* font size selector */
  81. float chi,theta,phi,dchi;    /* viewing angles/speeds */
  82. float lchi,ltheta;        /* light angle */
  83. float ambient;            /* ambient light level */
  84. float minX,maxX;    /* current min/max values */
  85. float minY,maxY;
  86. float minZ,maxZ;
  87. float aspect;        /* x,y/z aspect */
  88. RtColor flagcol[5];
  89. RtPoint Tick0,Tick1,Tick00,Tick01;        /* tick min/max for x-fer to shape */
  90. int Rmode,Rflags,Omode;
  91. char pscom[1000];    /* postscript buffer for DPSUserPath */
  92. float pspath[3000];    /* increases drawing speed substantially */
  93. float psbbox[4];
  94. int psc;        /* counter for user path */
  95. char initflag;        /* flag so timer knows the first time it's called */
  96. SetPref pref[MAXSETS];    /* preferences for data sets */
  97. }
  98.  
  99.  
  100. -initFrame:(NXRect *)myrect;
  101. -free;
  102.  
  103. /* rescales coord. system after size chaged */
  104. -superviewSizeChanged:(const NXSize *)oldsize;
  105.  
  106. /* draw 3d plot */
  107. -drawPS:(NXRect *)myrect :(int)rectCount;
  108.  
  109. /* change viewing angle */
  110. -setAng:(float)theta :(float)chi;
  111.  
  112. /* change phi */
  113. -setPhi:sender;
  114.  
  115. /* used to do mouse zooming and spinning */
  116. -mouseDown:(NXEvent *)event;
  117.  
  118. /* points to controller object, usually set with IB instead */
  119. -setcontroller:del;
  120.  
  121. /* called by timer to do one time step */
  122. -step;
  123.  
  124. -(int)acceptsFirstMouse;
  125.  
  126. /* recalculate and display plot (and density plot, via controller) */
  127. -zoom:sender;
  128.  
  129. /* change min/max values */
  130. -zoomTo:(float)minx :(float)miny :(float)maxx :(float)maxy;
  131.  
  132. /* toggles dchi=0 on and off */
  133. -togFreeze:sender;
  134.  
  135. /* Makes a surface map for a rib file*/
  136. -makeSMap:sender;
  137.  
  138. /* dump .rib file from 3d view */
  139. - dumpRib:sender;
  140.  
  141. /* currently does nothing */
  142. - renderSelf:(RtToken)context;
  143.  
  144. /* sets intensity of ambient light */
  145. - setAmbLight:sender;
  146.  
  147. /* sets intensity of distant light */
  148. - setLight:sender;
  149.  
  150. /* sets chi of distant light */
  151. - setLightX:sender;
  152.  
  153. /* sets theta of distant light */
  154. - setLightY:sender;
  155.  
  156. /* sets rendering mode */
  157. - setMode:sender;
  158.  
  159. /* prints window with white background */
  160. - printPSCode:sender;
  161.  
  162. /* set drawing flags */
  163. -setFlags:sender;
  164.  
  165. /* set overlay flags */
  166. -setOverlay:sender;
  167.  
  168. -setFlagColor:sender;
  169.  
  170. -size320:sender;
  171.  
  172. -setEye:sender;
  173.  
  174. -setAsp:sender;
  175.  
  176. /* set perspective or orthographic projection */
  177. -setProj:sender;
  178.  
  179. -tickCalc:(float)n :(float)x0 :(float)x1 :(float *)min :(float *)spa;
  180.  
  181. -(float)getTheta;
  182.  
  183. -(float)getChi;
  184.  
  185. -PRTiff:sender;
  186.  
  187. - renderTIFF:(char *)fsp;
  188.  
  189. /* reset aspect to 1:1 */
  190. - aspect11:sender;
  191. @end
  192.