home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 January / Chip_1997-01_cd.bin / ms95 / disk21 / dir03 / f011200.re_ / f011200.re
Text File  |  1996-04-02  |  13KB  |  329 lines

  1. /*----------------------------------------------------------------------+
  2. |                                    |
  3. |  Copyright (1995) Bentley Systems, Inc., All rights reserved.        |
  4. |                                    |
  5. |  "MicroStation", "MDL", and "MicroCSL" are trademarks of Bentley    |
  6. |  Systems, Inc.                            |
  7. |                                    |
  8. |  Limited permission is hereby granted to reproduce and modify this    |
  9. |  copyrighted material provided that the resulting code is used only     |
  10. |  in conjunction with Bentley Systems products under the terms of the    |
  11. |  license agreement provided therein, and that this notice is retained    |
  12. |  in its entirety in any such reproduction or modification.        |
  13. |                                    |
  14. +----------------------------------------------------------------------*/
  15. /*----------------------------------------------------------------------+
  16. |                                    |
  17. |   mdlhview.h  -- definitions for hidden line view interface           |
  18. |                                    |
  19. |   $Workfile:   mdlhview.h  $
  20. |   $Revision:   1.22  $
  21. |          $Date:   09 Nov 1995 09:51:10  $
  22. |                                    |
  23. +----------------------------------------------------------------------*/
  24. #if !defined (__mdlhviewH__)
  25. #define       __mdlhviewH__
  26.  
  27. /*----------------------------------------------------------------------+
  28. |                                    |
  29. |   Header File Dependencies                        |
  30. |                                    |
  31. +----------------------------------------------------------------------*/
  32. #include    "mselems.h"
  33. #include    "mstypes.h"
  34. #include    "stdio.h"
  35.  
  36. /*----------------------------------------------------------------------+
  37. |                                    |
  38. |   Defines                                |
  39. |                                    |
  40. +----------------------------------------------------------------------*/
  41. #define MDLHVIEW_OUTPUT_TRANSFORM_NONE                0
  42. #define MDLHVIEW_OUTPUT_TRANSFORM_PROJECT_TO_2D_VIEWPLANE   1
  43. #define MDLHVIEW_OUTPUT_TRANSFORM_PROJECT_TO_3D_VIEWPLANE   2
  44.  
  45. #define MDLHVIEW_FILE_OFF                0
  46. #define MDLHVIEW_FILE_2D                1
  47. #define MDLHVIEW_FILE_3D                2
  48. #define MDLHVIEW_FILE_3D_ORIGINAL_POSITION      3
  49.  
  50. #define MDLHVIEW_DEFAULT_ZBUFFER_RESOLUTION     1000
  51. #define MDLHVIEW_DEFAULT_WORKING_MEMORY         4096
  52.  
  53. #define MDLHVIEW_ANNOTATION_HIDE        0
  54. #define MDLHVIEW_ANNOTATION_ALWAYS        1
  55. #define MDLHVIEW_ANNOTATION_NEVER        2
  56.  
  57. /*----------------------------------------------------------------------+
  58. |                                    |
  59. |   Message codes for mdlHview_message(contextP, msg,ival, ptr)        |
  60. |                                    |
  61. | MESSAGE                                |
  62. |    ival = integer argument, meaning depends on message        |
  63. |    ptr  = pointer argument, meaning depends on message        |
  64. |   default: description of settings if the message is never sent    |
  65. |                                    |
  66. | A) Output geometry controls                        |
  67. |                                    |
  68. | MDLHVIEW_MSG_SET_VISIBLE_SYMBOLOGY                    |
  69. |    ival = 0                            |
  70. |    ptr  = pointer to EdgeSymbology structure to be used for    |
  71. |        visible edges.                        |
  72. |   default: all symbology as on original geoemtry.            |
  73. | MDLHVIEW_MSG_SET_HIDDEN_SYMBOLOGY                    |
  74. |    ival = 0                            |
  75. |    ptr  = pointer to EdgeSymbology structure to be used for    |
  76. |        hidden edges.  Note that this does NOT enable output    |
  77. |        of hidden edges -- it just sets the symbology for    |
  78. |        if they are enabled.  Send MDLHVIEW_MSG_INCLUDE_HIDDEN    |
  79. |        to enable the hidden edges.                |
  80. |   default: level, color, and weight as on original geometry.  Style    |
  81. |        dashed (i.e. the usual hidden-line style on drawings)    |
  82. |                                    |
  83. | MDLHVIEW_MSG_SET_INCLUDE_HIDDEN                    |
  84. |    ival = TRUE/FALSE flag indicating whether hidden lines are    |
  85. |        to be output (TRUE) or not (FALSE)            |
  86. |    ptr  = NULL                            |
  87. |   default: FALSE                            |
  88. |                                    |
  89. | MDLHVIEW_MSG_SET_INCLUDE_INTERSECTIONS                |
  90. |    ival = TRUE/FALSE indicating whether surface-surface        |
  91. |        intersections are to be computed.            |
  92. |    ptr  = NULL                            |
  93. |  default: FALSE                            |
  94. |    NOTE: Surface-surface intersections add significantly to        |
  95. |    compute time and memory use.                    |
  96. |                                    |
  97. | MDLHVIEW_MSG_SET_INCLUDE_RULES                    |
  98. |    ival = TRUE/FALSE flag indicating whether surface rule lines    |
  99. |        are to be output (TRUE) or not (FALSE)            |
  100. |    ptr  = NULL                            |
  101. |   default: FALSE                            |
  102. |                                    |
  103. | MDLHVIEW_MSG_SET_INCLUDE_ANNOTATION                    |
  104. |    ival = One of the following choices of handling of text,    |
  105. |        dimension, and other annotation geometry:        |
  106. |        MDLHVIEW_ANNOTATION_HIDE -- reduce the annotation to    |
  107. |            line strokes and process them through        |
  108. |            the hidden line algorithm, i.e. subject to    |
  109. |            hiding as with any other line strokes        |
  110. |        MDLHVIEW_ANNOTATION_ALWAYS -- output the annotation    |
  111. |            without testing for visibility.            |
  112. |        MDLHVIEW_ANNOTATION_NEVER -- ignore annotation        |
  113. |    ptr  = NULL                            |
  114. |  default: MDLHVIEW_ANNOTATION_HIDE                    |
  115. |                                    |
  116. | MDLHVIEW_MSG_SET_OUTPUT_TO_MASTER                    |
  117. |    ival = TRUE/FALSE to enable/disable output to the master file    |
  118. |    ptr  = NULL                            |
  119. |  default: false                            |
  120. |                                    |
  121. | B) Resolution Controls                        |
  122. | MDLHVIEW_MSG_SET_WORKING_MEMORY                    |
  123. |    ival = working memory, in killobytes.  E.g., ival=1024        |
  124. |        sets working memory to 1024kilbytes = 1 megabyte    |
  125. |    ptr  = NULL                            |
  126. |  default: 4096, i.e. 4Mb.                        |
  127. |                                    |
  128. | MDLHVIEW_MSG_SET_XRESOLUTION                        |
  129. | MDLHVIEW_MSG_SET_YRESOLUTION                        |
  130. |    ival = resolution to apply on the respective axis.        |
  131. |    ptr  = NULL                            |
  132. |   default: Both resolutions default to 1000                |
  133. | MDLHVIEW_MSG_SET_RESOLUTION_TO_SCREEN                    |
  134. |    ival = 0                            |
  135. |    ptr  = NULL                            |
  136. |   Sets both x and y resolution to match the screen in the view    |
  137. | MDLHVIEW_MSG_SET_RESOLUTION                        |
  138. |    ival = resoluton to apply on longer axis of view.  Shorter    |
  139. |        side is proportionally smaller.                |
  140. |    ptr  = NULL                            |
  141. |    (If MDLHVIEW_MSG_SET_NPC_WINDOW is being used to restrict    |
  142. |    attention to a subset of the view, only that rectangle is    |
  143. |    considered by MDLHVIEW_MSG_SET_RESOLUTION_TO_SCREEN and        |
  144. |    MDLHVIEW_MSG_SET_RESOLUTION)                    |
  145. |                                    |
  146. |                                    |
  147. | MDLHVIEW_MSG_SET_NPC_WINDOW                        |    |
  148. |    ival = 0                            |
  149. |    ptr  = pointer to a Dvector2d which defines the active rectangle|
  150. |        within the view.  Coordinate 00 is at the lower left,    |
  151. |        11 at the upper right.  All subsequent resolution    |
  152. |        changes are applied in this rectangle rather than the    |
  153. |        full view.  If the NPC window is to be changed, it    |
  154. |        must be done PRIOR TO setting resolutions.        |
  155. |   default: The entire window (00 to 11) is active.            |
  156. |                                    |
  157. | D) Fencing by polygons defined by the application            |
  158. |   These message control a set of polygons used to mask out portions    |
  159. |    of the view.  This masking is separate from the fencing        |
  160. |    controlled by MDL_HVIEW_SET_FENCEMODE.  Both types of fencing    |
  161. |    may be applied simultaneously.                    |
  162. |   The polygon mask set is applied strictly sequentially so as to    |
  163. |    define a mask that marks each point of the view as visible or    |
  164. |    hidden.   The mask itself is constructed at the start of     |
  165. |    each of the (several) passes that the hview algorithm makes    |
  166. |    through the view.   Application code can regenerate the mask    |
  167. |    for each reference file as follows: (1) send the message    |
  168. |        MDLHVIEW_MSG_SET_PRE_FILE_FUNCTION            |
  169. |    to define a callback to be invoked each time a reference file    |
  170. |    is opened, (2) clear and rebuild the polygon set, and (3) call    |
  171. |    mdlHview_applyMaskPolygons(contextP) to activate the set    |
  172. | MDLHVIEW_MSG_CLEAR_MASK_POLYGONS                    |
  173. |    ival = 0                            |
  174. |    ptr  = NULL                            |
  175. |  The saved set of mask polygons is cleared.                |
  176. | MDLHVIEW_MSG_SET_INSIDE_POLYGON                    |
  177. | MDLHVIEW_MSG_SET_OUTSIDE_POLYGON                    |
  178. |    ival = number of points                        |
  179. |    ptr  = pointer to an array of Dpoint3d structures defining    |
  180. |        the (3D) polygon.  When the mask is applied, points    |
  181. |        in the polygon are marked as visble (resp. hidden)    |
  182. |                                    |
  183. | D) Microstation fence                            |
  184. |                                    |
  185. | MDLHVIEW_MSG_SET_FENCEMODE                        |
  186. |    ival =     0 -- ignore the microstation fence            |
  187. |        1`-- compute visible edges inside the microstation    |
  188. |            fence                        |
  189. |        2 -- compute visible edges outside the microstation    |
  190. |            fence                        |
  191. |    ptr  = NULL                            |
  192. | default: The microstation fence is ignored.                |
  193. |                                    |
  194. | F) Callbacks and file handling                    |                            |
  195. | MDLHVIEW_MSG_SET_PROGRESS_FUNCTION                    |
  196. |    ival = 0                            |
  197. |    ptr  = pointer to a function to be called with updates        |
  198. |        of the progress.                    |
  199. |  The function arguments are:                        |
  200. |    func(char * messageP, double percentComplete)            |        |
  201. |   where messageP = string describing the progress.            |
  202. |      percentComplete = percent of computation completed.        |
  203. | default: Progress messages are issued to a dialog box with        |
  204. |    a completion bar.                        |
  205. |                                    |
  206. | MDLHVIEW_MSG_SET_PRE_FILE_FUNCTION                    |
  207. |    ival = 0                            |
  208. |    ptr  = pointer to a function to be called each time the master    |
  209. |        file or a reference file is opened for scanning,    |
  210. |        The paramter list is                    |
  211. |        preFileFunc (iFile)                    |
  212. |    where iFile is the file number.                    |
  213. | default: No pre-file function is called.                |
  214. |                                    |
  215. | MDLHVIEW_MSG_SET_FILE_HIDE_MASK                    |
  216. | MDLHVIEW_MSG_SET_FILE_INCLUDE_HIDDEN_MASK                |
  217. |    ival = 0                            |
  218. |    ptr  = pointer to an array of bit indicating whether        |
  219. |        the corresponding files (master=0, 1..255=reference    |
  220. |        files) are to be processed.                |
  221. |   The INCLUDE_HIDDEN mask allows hidden lines to be included        |
  222. |    in selected files.  (Turning on MDLHVIEW_MSG_SET_INCLUDE_HIDDEN    |
  223. |    is equivalent to setting all bits in this array to 1).        |
  224. |      The default for the INCLUDE_HIDDEN mask is all bits 0.        |
  225. |   The FILE_HIDE mask allows selected files to be skipped completely.    |
  226. |    A 1 bit in this array means the file is to be included in the    |
  227. |    scan, and a zero means skip.                    |
  228. |      The default for FILE_HIDE masks is all bits 1, i.e. scan all    |
  229. |    files.                                |
  230. |                                    |
  231. |                                     |
  232. | F) Rarely used options                        |
  233. | MDLHVIEW_MSG_SET_EDGE_DEPTH_CHANGE                        |
  234. |    ival = number of units of depth to subtract to edge coordinates    |
  235. |        to make them closer to the eye for depth comparisons.    |
  236. |    ptr  = NULL                            |
  237. |  default: zero (0).  It is strongly recommended that this value NOT    |
  238. |    be changed.                            |
  239. | MDLHVIEW_MSG_SET_EDGE_WIDTH                        |
  240. |    ival = Extra width, in pixels of resolution, to add to each    |
  241. |        side of edges as they are tested for visibility.    |
  242. |    ptr  = NULL                            |
  243. |  default: 1.  Reducing this to zero may cause some 'speckling'    |
  244. |        or 'stitching' effects, i.e. an solid edge appears    |
  245. |        to be dashed.  It may also reduce undesirable double    |
  246. |        drawing.                        |
  247. | MDLHVIEW_MSG_SET_INCLUDE_RAW_MESH                    |
  248. |    ival = TRUE/FALSE to enable/disable output of raw mesh on    |
  249. |        surfaces.                        |
  250. |    ptr  = NULL                            |
  251. |  default: FALSE                            |
  252. +----------------------------------------------------------------------*/
  253.  
  254. #define MDLHVIEW_MSG_SET_VISIBLE_SYMBOLOGY        -100
  255. #define MDLHVIEW_MSG_SET_HIDDEN_SYMBOLOGY        -101
  256. #define MDLHVIEW_MSG_SET_INCLUDE_HIDDEN            -102
  257. #define MDLHVIEW_MSG_SET_XRESOLUTION            -103
  258. #define MDLHVIEW_MSG_SET_YRESOLUTION            -104
  259. #define MDLHVIEW_MSG_SET_WORKING_MEMORY            -105
  260. #define MDLHVIEW_MSG_SET_INCLUDE_INTERSECTIONS        -106
  261. #define MDLHVIEW_MSG_SET_INCLUDE_RULES            -107
  262. #define MDLHVIEW_MSG_SET_EDGE_DEPTH_CHANGE        -108
  263. #define MDLHVIEW_MSG_SET_EDGE_WIDTH            -109
  264. #define MDLHVIEW_MSG_SET_FILE_HIDE_MASK            -110
  265. #define MDLHVIEW_MSG_SET_INCLUDE_ANNOTATION        -111
  266. #define MDLHVIEW_MSG_SET_OUTPUT_TO_MASTER        -112
  267. #define MDLHVIEW_MSG_SET_FILE_INCLUDE_HIDDEN_MASK   -113
  268. #define MDLHVIEW_MSG_SET_FENCEMODE            -114
  269. #define MDLHVIEW_MSG_SET_RESOLUTION            -115
  270. #define MDLHVIEW_MSG_SET_RESOLUTION_TO_SCREEN        -116
  271. #define MDLHVIEW_MSG_CLEAR_MASK_POLYGONS        -117
  272. #define MDLHVIEW_MSG_SET_INSIDE_POLYGON            -118
  273. #define MDLHVIEW_MSG_SET_OUTSIDE_POLYGON        -119
  274. #define MDLHVIEW_MSG_SET_INCLUDE_RAW_MESH        -120
  275. #define MDLHVIEW_MSG_SET_NPC_WINDOW            -121
  276. #define MDLHVIEW_MSG_SET_PROGRESS_FUNCTION        -122
  277. #define MDLHVIEW_MSG_SET_PRE_FILE_FUNCTION        -123
  278. #define MDLHVIEW_MSG_APPLY_MASK_POLYGONS        -124
  279.  
  280. #define MDLHVIEW_MSG_SET_COMPLETION_TITLE        -130
  281. #define MDLHVIEW_MSG_SET_MULTIBAND_MESSAGE           -131
  282. #define MDLHVIEW_MSG_SET_PROCESSING_INTERSECTIONS_MESSAGE  -132
  283.  
  284.  
  285. /*----------------------------------------------------------------------+
  286. |                                    |
  287. |   Typedefs                                |
  288. |                                    |
  289. +----------------------------------------------------------------------*/
  290. typedef void (*MdlHview_progressFunction)
  291. (
  292. char    *messageP,
  293. double    percentComplete
  294. );    
  295.  
  296. typedef int (*MdlHview_preFileFunction)
  297. (
  298. int        fileNumber
  299. );    
  300.     
  301. typedef void (*MdlHview_PassThroughFunction)
  302. (
  303. MSElementDescr *edP,    /* => element descriptor being passed through */
  304. int iFile,        /* => file number */
  305. int iPos,        /* => file position */
  306. void *contextVoidP    /* => application data pointer */
  307. );
  308.                     
  309. typedef void (*MdlHview_outputFunction)
  310. (
  311. MSElementDescr    *displayEdP,
  312. MSElementDescr    *outputEdP,
  313. HLineSymbology    *symbologyP,
  314. int        fileNumber
  315. );
  316.  
  317. struct hviewContext;                    
  318. typedef struct hviewContext *HviewContextP;
  319.  
  320.  
  321. /*----------------------------------------------------------------------+
  322. |                                    |
  323. |   Macros                                |
  324. |                                    |
  325. +----------------------------------------------------------------------*/
  326.  
  327.  
  328. #endif    /* !defined (__mdlhviewH__) */
  329.