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

  1. /*----------------------------------------------------------------------+
  2. |                                    |
  3. |  Copyright (c) 1985-93;  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. |   mslstyle.h -- MicroStation line style structures and constants    |
  18. |                                    |
  19. |   $Workfile:   mslstyle.h  $
  20. |   $Revision:   6.0  $
  21. |          $Date:   Thu Oct 21 10:41:54 1993  $
  22. |                                    |
  23. +----------------------------------------------------------------------*/
  24. #ifndef __mslstyleH__
  25. #define __mslstyleH__
  26.  
  27. /*----------------------------------------------------------------------+
  28. |                                    |
  29. |   Header File Dependencies                        |
  30. |                                    |
  31. +----------------------------------------------------------------------*/
  32. #include "basedefs.h"
  33. #include "rscdefs.h"
  34. #include "basetype.h"
  35.  
  36. /*----------------------------------------------------------------------+
  37. |                                    |
  38. |   Constants                                |
  39. |                                    |
  40. +----------------------------------------------------------------------*/
  41. #define STYLELINK_ID        0x79f9      /* Attribute ID (rad50 'STY')  */
  42.  
  43. #define LC_MAX_STROKES        32        /* Max strokes in line code    */
  44. #define LS_MAX_DESCR        128          /* Resource description length */
  45. #define    LS_MAX_NAME        64        /* Maximum name length           */
  46.  
  47. #define LSTYPE_Internal     0
  48. #define LSID_DEFAULT        0
  49. #define LSID_HARDWARE        0x80000000
  50. #define LSID_HWMASK        0x0000000f
  51.  
  52. #define LSATTR_UNITMASK     0x00000003
  53. #define LSATTR_UNITMASTER   0x00000000    /* Units = master units           */
  54. #define LSATTR_UNITUOR      0x00000001    /* Unit def in world coords    */
  55. #define LSATTR_UNITDEV      0x00000002    /* Unit def in device coords   */
  56.  
  57. /*======================================================================+
  58. |                                    |
  59. |   mdlLineStyle_ function options                    |
  60. |                                    |
  61. +======================================================================*/
  62. /*-----------------------------------------------------------------------
  63. mdlLineStyle_query options
  64. -----------------------------------------------------------------------*/
  65. #define LSQUERY_RSCFILEHANDLE    1
  66. #define LSQUERY_RSCFILENAME    2
  67. #define LSQUERY_RANGE        3
  68. #define LSQUERY_NAMEMAP        4
  69. #define LSQUERY_IDMAP        5
  70.  
  71. /*-----------------------------------------------------------------------
  72. mdlLineStyle_nameQuery options
  73. -----------------------------------------------------------------------*/
  74. #define LSQUERY_FILEMASK    0x000000ff
  75. #define LSQUERY_STYLEID        0x80000000
  76.  
  77. /*-----------------------------------------------------------------------
  78. mdlLineStyle_nameDelete options
  79. -----------------------------------------------------------------------*/
  80. #define LSNAME_FREECOMPONENTS   0x00000001
  81.  
  82. /*-----------------------------------------------------------------------
  83. mdlLineStyle_getElementDescr options
  84. -----------------------------------------------------------------------*/
  85. #define LSOPT_SETGG        0x01
  86.  
  87. /*----------------------------------------------------------------------+
  88. |                                    |
  89. |   Macros                                |
  90. |                                    |
  91. +----------------------------------------------------------------------*/
  92. #define LC_RSCSIZE(n) (sizeof(LineCodeRsc)  + (((n)-1) * sizeof(LineCodeStroke)))
  93. #define LP_RSCSIZE(n) (sizeof(LinePointRsc) + (((n)-1) * sizeof(PointSymInfo)))
  94. #define LS_RSCSIZE(n) (sizeof(LineStyleRsc) + (((n)-1) * sizeof(ComponentInfo)))
  95.  
  96. /*======================================================================+
  97. |                                    |
  98. |   Structure typedefs for Line Style API functions              |
  99. |                                    |
  100. +======================================================================*/
  101. /*----------------------------------------------------------------------+
  102. |                                    |
  103. |   Line Style params structure.                           |
  104. |                                    |
  105. |   Modifier options are applied to the "modifiers" structure member    |
  106. |   and can be combined using the bitwise OR ("|") operator.        |                                    |
  107. |                                    |
  108. +----------------------------------------------------------------------*/
  109. #define STYLEMOD_SCALE      0x01        /* scale present           */
  110. #define STYLEMOD_DSCALE        0x02        /* dash scale present      */
  111. #define STYLEMOD_GSCALE        0x04        /* gap scale present       */
  112.  
  113. #define STYLEMOD_SWIDTH        0x08        /* start width present     */
  114. #define STYLEMOD_EWIDTH        0x10        /* end width present       */
  115.  
  116. #define STYLEMOD_DISTPHASE    0x20        /* distance phase present  */
  117. #define STYLEMOD_FRACTPHASE    0x40        /* fraction phase present  */
  118. #define STYLEMOD_RESPHASE    0x80        /* phase mode reserved     */
  119.  
  120. /*-----------------------------------------------------------------------
  121. The modifiers in the second byte apply only in 3d
  122. -----------------------------------------------------------------------*/
  123. #define STYLEMOD_NORMAL               0x0100      /* surface normal present  */
  124. #define STYLEMOD_RMATRIX    0x0200      /* rotation matrix present */
  125.  
  126. #define STYLEMOD_NOSEGMODE      0x80000000  /* disable single segment  */
  127.  
  128. #ifndef resource
  129.  
  130. typedef struct
  131.     {
  132.     ULong       modifiers;      /* see STYLEMOD_... above           */
  133.     ULong       reserved;
  134.     double      scale;        /* Applied to all length values           */
  135.     double      dashScale;    /* Applied to adjustable dash strokes  */
  136.     double      gapScale;    /* Applied to adjustable gap strokes   */
  137.     double    startWidth;    /* Taper start width               */
  138.     double    endWidth;    /* Taper end width               */
  139.     double    distPhase;      /* Phase shift by distance           */
  140.     double      fractPhase;    /* Phase shift by fraction           */
  141.     DPoint3d    normal;
  142.     RotMatrix   rMatrix;
  143.     } StyleParam, LineStyleParams;
  144.  
  145. /*----------------------------------------------------------------------+
  146. |                                    |
  147. |   LineStyleNameInfo                            |
  148. |                                    |
  149. |   Information returned from the mdlLineStyle_nameQuery function       |
  150. |                                    |
  151. +----------------------------------------------------------------------*/
  152. typedef struct
  153.     {
  154.     ULong        rscFile;    /* Resource file handle               */
  155.     ULong        rscType;    /* Resource type               */
  156.     ULong        rscID;    /* Resource ID                   */
  157.     ULong        attributes;    /* Name Attributes               */
  158.     long        styleID;    /* Style ID for MASTERFILE           */
  159.     } LineStyleNameInfo;
  160.  
  161. #endif
  162.  
  163. /*======================================================================+
  164. |                                    |
  165. |   Resource structures                            |
  166. |                                    |
  167. +======================================================================*/
  168. /*----------------------------------------------------------------------+
  169. |                                    |
  170. |   Line style name map resource structures.                |
  171. |                                    |
  172. |   The line style name map resources use the same structure as        |
  173. |   StringLists but they are always stored in packed little-endian    |
  174. |   format.                                |
  175. |                                    |
  176. +----------------------------------------------------------------------*/
  177. #ifdef resource
  178.  
  179. typedef StringList LineStyleNames;
  180.  
  181. resourceclass LineStyleNames        RTYPE_LineStyleNames;
  182.  
  183. #endif
  184.  
  185. /*----------------------------------------------------------------------+
  186. |                                    |
  187. |   Line Style Resource                            |
  188. |   RTYPE_LineStyle                            |
  189. |                                    |
  190. |   This resource definition is used for the "Compound" line style    |
  191. |   component. It can be defined in a resource text file using the      |
  192. |   type RTYPE_LineStyle.                        |
  193. |                                    |
  194. |   For the first release, only the following fields are used.        |
  195. |                                    |
  196. |        descr                                    |
  197. |    nComp                                |
  198. |    component[n].type                        |
  199. |    component[n].id                            |
  200. |    component[n].offset                        |
  201. |                                    |
  202. |   Make sure all other fields are set to zero to insure compatibility    |
  203. |   with future versions                        |
  204. |                                    |
  205. +----------------------------------------------------------------------*/
  206. typedef struct
  207.     {
  208.     ULong       type;
  209.     ULong       id;
  210.     ULong       lReserved1, lReserved2, lReserved3, lReserved4;
  211.     double      offset;
  212.     double      dReserved1;
  213.     double      dReserved2;
  214.     double      dReserved3;
  215.     } ComponentInfo;
  216.  
  217. typedef struct
  218.     {
  219.     char        descr[LS_MAX_DESCR];
  220.     ULong        lHdr1, lHdr2, auxType, auxID, lRes1, lRes2;
  221.     double        dReserved1;
  222.     double        dReserved2;
  223.     ULong        lRes3;
  224. #ifdef resource
  225.     ComponentInfo   component[];
  226. #else
  227.     ULong        nComp;
  228.     ComponentInfo   component[1];
  229. #endif
  230.     } LineStyleRsc;
  231.  
  232. #ifdef resource
  233. resourceclass LineStyleRsc    RTYPE_LineStyle;
  234. #endif
  235.  
  236. /*----------------------------------------------------------------------+
  237. |                                    |
  238. |   Line Code Resource                            |
  239. |   RTYPE_LineCode                            |
  240. |                                    |
  241. |   This resource defines the line code component of the line style.    |
  242. |   In the user documentation, this is referred to as the "stroke    |
  243. |   pattern" component.                            |
  244. |                                    |
  245. |   For the first release, only the following fields are used.        |
  246. |                                    |
  247. |     descr                                |
  248. |        phase                                |
  249. |       options                                |
  250. |        maxIterate                            |
  251. |       nStrokes                            |
  252. |    stroke[n].length                        |
  253. |       stroke[n].width                            |
  254. |    stroke[n].endWidth                        |
  255. |       stroke[n].strokeMode                        |
  256. |       stroke[n].widthMode                        |
  257. |                                    |
  258. |   Make sure all other fields are set to zero to insure compatibility    |
  259. |   with future versions                        |
  260. |                                    |
  261. +----------------------------------------------------------------------*/
  262.                 /* Values for "options" member           */
  263. #define LCOPT_NONE        0x00000000
  264. #define LCOPT_AUTOPHASE        0x00000001
  265. #define LCOPT_RES1        0x00000002
  266. #define LCOPT_RES2        0x00000004
  267. #define LCOPT_ITERATION        0x00000008   /* Uses iteration limit   */
  268. #define LCOPT_SEGMENT        0x00000010   /* Single segment mode    */
  269.  
  270.                 /* Values for strokeMode           */
  271. #define LCSTROKE_DASH        0x01
  272. #define LCSTROKE_GAP        0x00
  273. #define LCSTROKE_RAY        0x02
  274. #define LCSTROKE_SCALE        0x04    /* Stroke can be scaled           */
  275. #define LCSTROKE_SDASH        0x05    /* Short for dash and scale    */
  276. #define LCSTROKE_SGAP        0x04    /* Short for gap and scale     */
  277.  
  278. #define LCSTROKE_SINVERT    0x08    /* Invert stroke in first code */
  279. #define    LCSTROKE_EINVERT    0x10    /* Invert stroke in last code  */
  280.  
  281.                 /* Values for widthMode               */
  282. #define LCWIDTH_NONE        0x00
  283. #define LCWIDTH_LEFT        0x01
  284. #define LCWIDTH_RIGHT        0x02
  285. #define LCWIDTH_FULL        0x03
  286. #define LCWIDTH_TAPER        0x04
  287. #define LCWIDTH_TAPEREND    0x08
  288.  
  289. /*-----------------------------------------------------------------------
  290. 0 - Standard closed polygon (rectangle) strokes.
  291. 1 - No end cap. The stroke is displayed as two parallel lines.
  292. 2 - The end of the stroke is extended by half the stroke width.
  293. 3...
  294.     If cap mode is >= 3, the cap is stroked as an arc and the value of
  295.     capMode indicates the number of vectors in the arc.
  296. -----------------------------------------------------------------------*/
  297. #define LCCAP_CLOSED        0
  298. #define LCCAP_OPEN        1
  299. #define LCCAP_EXTENDED        2
  300. #define LCCAP_HEXAGON        3
  301. #define LCCAP_OCTAGON        4
  302. #define LCCAP_DECAGON        5
  303. #define    LCCAP_ARC        30
  304.  
  305. typedef struct
  306.     {
  307.     double    length;        /* Stroke length               */
  308.     double      width;        /* Stroke width    (or start width)       */
  309.     double      endWidth;    /* End width of tapered stroke           */
  310.     double      dReserved;
  311.     long    lReserved1;
  312.     long    lReserved2;
  313.     long    lReserved3;
  314.  
  315.     byte    strokeMode;    /* bit 0: dash        | gap    dash  */
  316.                 /* bit 1: trace mode    | linear ray   */
  317.                 /* bit 2: scale mode    | off    on    */
  318.                 /* bit 3: start invert               */
  319.                 /* bit 4: end invert               */
  320.  
  321.     byte    widthMode;    /* bit 0: left half    | off    on    */
  322.                 /* bit 1: right half    | off    on    */
  323.                 /* bit 2: in taper      | no     yes   */
  324.                 /* bit 3: end taper    | no     yes   */
  325.     byte    capMode;
  326.     byte    bReserved;
  327.     } StrokeData, LineCodeStroke;
  328.  
  329. typedef struct
  330.     {
  331.     char      descr[LS_MAX_DESCR];
  332.     ULong      lHdr1, lHdr2, auxType, auxID;
  333.     double      phase;
  334.     double      orgAngle;
  335.     double      endAngle;
  336.     double      dReserved1, dReserved2, dReserved3;
  337.     ULong      options;
  338.     ULong      maxIterate;
  339.     ULong      lReserved;
  340. #ifdef resource
  341.     StrokeData    stroke[];
  342. #else
  343.     ULong      nStrokes;
  344.     StrokeData    stroke[1];
  345. #endif
  346.     } LineCodeRsc;
  347.  
  348. #ifdef resource
  349. resourceclass LineCodeRsc     RTYPE_LineCode;
  350. #endif
  351.  
  352. /*----------------------------------------------------------------------+
  353. |                                    |
  354. |   Line Point Resource                            |
  355. |   RTYPE_LinePoint                            |
  356. |                                    |
  357. |   For the first release, only the following fields are used.        |
  358. |                                    |
  359. |     descr                                |
  360. |        lcType                                |
  361. |       lcID                                |
  362. |        maxIterate                            |
  363. |       nStrokes                            |
  364. |    symbol[n].symType                        |
  365. |       symbol[n].symID                            |
  366. |    symbol[n].strokeNo                        |
  367. |       symbol[n].mod1                            |
  368. |                                    |
  369. |   Make sure all other fields are set to zero to insure compatibility    |
  370. |   with future versions                        |
  371. |                                    |
  372. |   mod1 field is defined as follows                    |
  373. |                                    |
  374. |   Bits 0-1                                |
  375. |    0 - Ignore strokeNo - no point at stroke            |
  376. |        1 - Point at origin of strokeNo                    |
  377. |        2 - Point at end of strokeNo                    |
  378. |       3 - Point at center of strokeNo                    |
  379. |                                    |
  380. |   Bit 2                                |
  381. |       Point at line origin if set                    |
  382. |                                    |
  383. |   Bit 3                                |
  384. |        Point at line end if set                    |
  385. |                                    |
  386. |   Bit 4                                |
  387. |       Point at each vertex if set                    |
  388. |                                    |
  389. +----------------------------------------------------------------------*/
  390.                 /* Values for "mod1"               */
  391. #define LCPOINT_NONE        0x0000  /* No point symbol           */
  392. #define LCPOINT_ORIGIN        0x0001  /* Symbol at origin of stroke  */
  393. #define LCPOINT_END        0x0002  /* Symbol at end of stroke     */
  394. #define LCPOINT_CENTER        0x0003  /* Symbol at center of stroke  */
  395. #define LCPOINT_ONSTROKE       0x0003  /* test mask               */
  396.  
  397. #define    LCPOINT_LINEORG        0x0004  /* Symbol at origin of element */
  398. #define    LCPOINT_LINEEND        0x0008  /* Symbol at end of element    */
  399. #define    LCPOINT_LINEVERT        0x0010  /* Symbol at each vertex       */
  400.  
  401. #define    LCPOINT_ADJROT        0x0020  /* Adjust rotation left->right */
  402. #define LCPOINT_ABSROT        0x0040  /* Angles not relative to line */
  403.  
  404.                  /* 0x0080 unused */
  405.  
  406. #define LCPOINT_NOSCALE        0x0100  /* No scale on variable strokes*/
  407. #define LCPOINT_NOCLIP        0x0200  /* No clip on partial strokes  */
  408.  
  409. #define LCPOINT_NOPARTIAL    0x0400     /* No partial strokes           */
  410. #define LCPOINT_PROJECT            0x0800     /* Project partial origin      */
  411.  
  412.                  /* 0x1000 unused */
  413.                  /* 0x2000 unused */
  414.  
  415. #define LCPOINT_COLOR        0x4000  /* Use color from symbol       */
  416. #define LCPOINT_WEIGHT        0x8000  /* Use weight from symbol      */
  417.  
  418. typedef struct
  419.     {
  420.     ULong      symType;
  421.     ULong      symID;
  422.     UShort      strokeNo;
  423.     UShort      mod1;
  424.     ULong      mod2;
  425.  
  426.     double      xOffset;
  427.     double      yOffset;
  428.     double      zOffset;
  429.     double      xAngle;
  430.     double      yAngle;
  431.     double      zAngle;
  432.     double      xScale;
  433.     double      yScale;
  434.     double      zScale;
  435.     } PointSymInfo, PointSymRscInfo;
  436.  
  437. typedef struct
  438.     {
  439.     char      descr[LS_MAX_DESCR];
  440.     ULong      lHdr1, lHdr2, auxType, auxID;
  441.     double      dReserved1;
  442.     ULong      lcType;
  443.     ULong      lcID;
  444.     ULong      lReserved1;
  445. #ifdef resource
  446.     PointSymInfo  symbol[];     /* Point symbol info               */
  447. #else
  448.     ULong      nSym;           /* Number of point symbols           */
  449.     PointSymInfo  symbol[1];    /* Point symbol components           */
  450. #endif
  451.     } LinePointRsc;
  452.  
  453. #ifdef resource
  454. resourceclass LinePointRsc    RTYPE_LinePoint;
  455. #endif
  456.  
  457. /*----------------------------------------------------------------------+
  458. |                                    |
  459. |   Point Symbol Resource                          |
  460. |   RTYPE_PointSym                            |
  461. |                                    |
  462. |   Only the following fields are used.                    |
  463. |                                    |
  464. |     descr                                |
  465. |        range                                |
  466. |       symFlags                            |
  467. |        nBytes                                |
  468. |                                    |
  469. |   Make sure all other fields are set to zero to insure compatibility    |
  470. |   with future versions                        |
  471. |                                    |
  472. +----------------------------------------------------------------------*/
  473.                 /* Values for "symFlags"            */
  474. #define LSSYM_3D        0x01    /* 3d symbol               */
  475.  
  476. typedef struct
  477.     {
  478.     DPoint3d    low;
  479.     DPoint3d    high;
  480.     } SymbolRange;
  481.  
  482. typedef struct
  483.     {
  484.     struct
  485.     {
  486.         char        descr[LS_MAX_DESCR];
  487.         ULong       lHdr1, lHdr2, auxType, auxID;
  488.     SymbolRange range;
  489.         DPoint3d    offset;
  490.         double      scale;
  491.         double      dReserve[12];
  492.     } header;
  493.  
  494.     ULong       symFlags;
  495. #ifndef resource
  496.     ULong       nBytes;
  497.     byte        symBuf[8];
  498. #else
  499.     byte        symBuf[];
  500. #endif
  501.  
  502.     } PointSymRsc;
  503.  
  504. #ifdef resource
  505. resourceclass PointSymRsc    RTYPE_PointSym;
  506. #endif
  507.  
  508. #endif
  509.