DgnElements.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
10 #include <Bentley/Bentley.h>
13 // #include <DgnPlatform/IAuxCoordSys.h>
14 #include <Bentley/CodePages.h>
15 
16 DGNPLATFORM_TYPEDEFS (AttributeElm)
17 DGNPLATFORM_TYPEDEFS (ViewElement)
18 DGNPLATFORM_TYPEDEFS (SharedCell)
19 DGNPLATFORM_TYPEDEFS (SharedCellDef)
20 DGNPLATFORM_TYPEDEFS (LevelMaskElm)
21 DGNPLATFORM_TYPEDEFS (Elm_hdr)
22 
23 typedef char VariChar; // CHAR_OK
24 typedef VariChar const* VariCharCP;
25 typedef VariChar* VariCharP;
26 
28 
29 struct MicroStationAppIdRootsCallback;
30 
32 /*----------------------------------------------------------------------+
33 | |
34 | Element Type Masks - Can be used to set up type masks for scanner |
35 | or element modification commands |
36 | |
37 +----------------------------------------------------------------------*/
38 // The following masks must be 'OR'ed with typemask[0]
39 #define ELMBITMSK(elmNum) (1<<((elmNum-1)%16))
40 #define TMSK0_CELL_LIB ELMBITMSK (CELL_LIB_ELM)
41 #define TMSK0_CELL_HEADER ELMBITMSK (CELL_HEADER_ELM)
42 #define TMSK0_LINE ELMBITMSK (LINE_ELM)
43 #define TMSK0_LINE_STRING ELMBITMSK (LINE_STRING_ELM)
44 #define TMSK0_GROUP_DATA ELMBITMSK (GROUP_DATA_ELM)
45 #define TMSK0_SHAPE ELMBITMSK (SHAPE_ELM)
46 #define TMSK0_TEXT_NODE ELMBITMSK (TEXT_NODE_ELM)
47 #define TMSK0_DIG_SETDATA ELMBITMSK (DIG_SETDATA_ELM)
48 #define TMSK0_DGNFIL_HEADER ELMBITMSK (DGNFIL_HEADER_ELM)
49 #define TMSK0_LEV_SYM ELMBITMSK (LEV_SYM_ELM)
50 #define TMSK0_CURVE ELMBITMSK (CURVE_ELM)
51 #define TMSK0_CMPLX_STRING ELMBITMSK (CMPLX_STRING_ELM)
52 #define TMSK0_CONIC ELMBITMSK (CONIC_ELM)
53 #define TMSK0_CMPLX_SHAPE ELMBITMSK (CMPLX_SHAPE_ELM)
54 #define TMSK0_ELLIPSE ELMBITMSK (ELLIPSE_ELM)
55 #define TMSK0_ARC ELMBITMSK (ARC_ELM)
56 
57 // These following masks must be 'OR'ed with typemask[1]
58 #define TMSK1_TEXT ELMBITMSK (TEXT_ELM)
59 #define TMSK1_SURFACE ELMBITMSK (SURFACE_ELM)
60 #define TMSK1_SOLID ELMBITMSK (SOLID_ELM)
61 #define TMSK1_BSPLINE_POLE ELMBITMSK (BSPLINE_POLE_ELM)
62 #define TMSK1_POINT_STRING ELMBITMSK (POINT_STRING_ELM)
63 #define TMSK1_CONE ELMBITMSK (CONE_ELM)
64 #define TMSK1_BSPLINE_SURFACE ELMBITMSK (BSPLINE_SURFACE_ELM)
65 #define TMSK1_BSURF_BOUNDARY ELMBITMSK (BSURF_BOUNDARY_ELM)
66 #define TMSK1_BSPLINE_KNOT ELMBITMSK (BSPLINE_KNOT_ELM)
67 #define TMSK1_BSPLINE_CURVE ELMBITMSK (BSPLINE_CURVE_ELM)
68 #define TMSK1_BSPLINE_WEIGHT ELMBITMSK (BSPLINE_WEIGHT_ELM)
69 
70 // These following masks must be 'OR'ed with typemask[2]
71 #define TMSK2_DIMENSION ELMBITMSK (DIMENSION_ELM)
72 #define TMSK2_SHAREDCELL_DEF ELMBITMSK (SHAREDCELL_DEF_ELM)
73 #define TMSK2_SHARED_CELL ELMBITMSK (SHARED_CELL_ELM)
74 #define TMSK2_MULTILINE ELMBITMSK (MULTILINE_ELM)
75 #define TMSK2_ATTRIBUTE ELMBITMSK (ATTRIBUTE_ELM)
76 #define TMSK2_TYPE44 ELMBITMSK (TYPE44_ELM)
77 #define TMSK2_DGNSTORE_HDR ELMBITMSK (DGNSTORE_HDR)
78 
79 // These following masks must be 'OR'ed with typemask[4]
80 #define TMSK4_MICROSTATION_ELM ELMBITMSK (MICROSTATION_ELM)
81 
82 // These following masks must be 'OR'ed with typemask[5]
83 #define TMSK5_RASTER_HDR ELMBITMSK (RASTER_HDR)
84 #define TMSK5_RASTER_COMP ELMBITMSK (RASTER_COMP)
85 #define TMSK5_RASTER_LINK ELMBITMSK (RASTER_REFERENCE_ELM)
86 #define TMSK5_RASTER_REFCMPN ELMBITMSK (RASTER_REFERENCE_COMP)
87 #define TMSK5_RASTER_HIERARCHY ELMBITMSK (RASTER_HIERARCHY_ELM)
88 #define TMSK5_RASTER_HIERARCHYCMPN ELMBITMSK (RASTER_HIERARCHY_COMP)
89 #define TMSK5_RASTER_FRAME ELMBITMSK (RASTER_FRAME_ELM)
90 #define TMSK5_TABLE_ENTRY ELMBITMSK (TABLE_ENTRY_ELM)
91 #define TMSK5_TABLE ELMBITMSK (TABLE_ELM)
92 
93 // These following masks must be 'OR'ed with typemask[6]
94 #define TMSK6_MATRIX_HEADER ELMBITMSK (MATRIX_HEADER_ELM)
95 #define TMSK6_MATRIX_INT_DATA ELMBITMSK (MATRIX_INT_DATA_ELM)
96 #define TMSK6_MATRIX_DOUBLE_DATA ELMBITMSK (MATRIX_DOUBLE_DATA_ELM)
97 #define TMSK6_MESH_HEADER ELMBITMSK (MESH_HEADER_ELM)
98 #define TMSK6_EXTENDED ELMBITMSK (EXTENDED_ELM)
99 #define TMSK6_EXTENDED_NONGRAPHIC_ELM ELMBITMSK (EXTENDED_NONGRAPHIC_ELM)
100 #define TMSK6_VIEW_GROUP ELMBITMSK (VIEW_GROUP_ELM)
101 #define TMSK6_VIEW ELMBITMSK (VIEW_ELM)
102 #define TMSK6_LEVEL_MASK ELMBITMSK (LEVEL_MASK_ELM)
103 #define TMSK6_REFERENCE_ATTACH ELMBITMSK (REFERENCE_ATTACH_ELM)
104 #define TMSK6_NAMED_GROUP_HDR ELMBITMSK (NAMED_GROUP_HDR_ELM)
105 #define TMSK6_DGNCOMPONENT_INSTANCE ELMBITMSK (DGNCOMPONENT_INSTANCE_ELM)
106 
107 /*----------------------------------------------------------------------+
108 | |
109 | Element Processing Status codes -- Can be used to control |
110 | selective tree traversals. |
111 | |
112 +----------------------------------------------------------------------*/
113 #define MDLELMDSCR_OPERATION_SKIP_MY_CHILDREN (-10)
114 /*----------------------------------------------------------------------+
115 | |
116 | Level definitions |
117 | |
118 +----------------------------------------------------------------------*/
119 #define MSSTARTAPP_LEVEL 10
120 
121 #define MSXBASE_LEVEL 10 // Xbase
122 #define MSDB_LEVEL 10 // exists for backwards compatibility to XBASE
123 #define MSIX_LEVEL 11 // Informix
124 #define MSRIS_LEVEL 12 // RIS
125 #define MSORACLE_LEVEL 13 // Oracle
126 #define MSINGRES_LEVEL 14 // INGRES
127 #define MSSYBASE_LEVEL 15 // Sybase
128 #define MSODBC_LEVEL 16 // ODBC
129 #define MSCTMORCL_LEVEL 17 // Continuum Oracle
130 #define MSOLEDB_LEVEL 18 // OLEDB
131 #define MSBUDBC_LEVEL 19 // Bentley Universal Database Connection
132 
133 #define MSAPPINFO_LEVEL 20
134 #define MSSTARTMDL_LEVEL 21
135 #define MSATTRDATA_LEVEL 24
136 #define MSTCBEXT_LEVEL 25
137 #define MSMAP_LEVEL 26
138 #define MSBREP_LEVEL 28
139 #define MSPROJECTBANK_LEVEL 29
140 #define MSMODELELEMENT_LEVEL 32
141 #define MSUPDATESEQUENCE_LEVEL 33
142 
144 #define MS_LEVEL_TABLE_LEVEL 1
145 #define MS_FONT_TABLE_LEVEL 2
146 #define MS_TEXTSTYLE_TABLE_LEVEL 3
147 #define MS_FILTER_TABLE_LEVEL 4
148 #define MS_DIMSTYLE_TABLE_LEVEL 5
149 #define MS_MLINESTYLE_TABLE_LEVEL 6
150 #define MS_LSTYLE_NAME_LEVEL 7
151 #define MS_LSTYLE_DEF_LEVEL 8
152 #define MS_DICTIONARY_TABLE_LEVEL 9
153 #define MS_REGAPP_TABLE_LEVEL 10
154 #define MS_COLORBOOK_TABLE_LEVEL 11
155 #define MS_CUSTOM_RENDERMODE_LEVEL 12 // Deprecated (never used in production).
156 #define MS_SYMBOLSTYLE_TABLE_LEVEL 16
157 #define MS_COLORBOOK_LEVEL 17
158 #define MS_MATERIAL_PALETTE_LEVEL 18
159 #define MS_LEVEL_NAME_DICTIONARY_TABLE_LEVEL 19
160 #define MS_ANIMATION_PARAMETER_TABLE_LEVEL 20
161 #define MS_ANIMATION_SCHEDULEINFO_TABLE_LEVEL 21
162 #define MS_RENDERSETUP_LEVEL 22
163 #define MS_LIGHTSETUP_LEVEL 23
164 #define MS_NAMED_PRESENTATION_TABLE_LEVEL 24
165 #define MS_MAX_VALID_TABLE_LEVEL MS_NAMED_PRESENTATION_TABLE_LEVEL
166 #define MS_NUM_VALID_TABLE_LEVELS (MS_MAX_VALID_TABLE_LEVEL+1)
167 
168 
170 #define VIEW_GROUP_HDR_LEVEL 1
171 
173 #define VIEW_HDR_LEVEL 1
174 
175 /*----------------------------------------------------------------------+
176 | |
177 | MicroStation Application Element Signatures |
178 | |
179 +----------------------------------------------------------------------*/
180 #define MSEXACTCOLOR_SIGNATURE 140
181 #define MSDIGITAL_SIGNATURE 22145
182 #define MSMODELER_SIGNATURE 20286
183 #define MSIMAGEMANAGER_SIGNATURE 22082
184 #define MSFARREFELM_SIGNATURE 22246
185 #define MSDESIGNLINKS_SIGNATURE 22594
186 #define MSCONFLICTS_SIGNATURE 22275
187 #define MSAPPLICATIONSETTINGS_SIGNATURE 22276
188 #define MSRELATIONSHIPS_SIGNATURE 22277
189 #define MSGEOCOORD_SIGNATURE 182 // 0x00b6
190 
191 /*----------------------------------------------------------------------+
192 | |
193 | Raster Element (Type 87) Data Types |
194 | |
195 +----------------------------------------------------------------------*/
196 enum MSRasterElemTypes
197 {
198  BITMAP_RASTER = 1,
199  BYTE_DATA_RASTER = 2,
200  BINARY_RLE_RASTER = 9,
201  BYTE_RLE_RASTER = 24,
202 };
203 
204 /*----------------------------------------------------------------------+
205 | |
206 | Surface/Solid Types |
207 | |
208 +----------------------------------------------------------------------*/
209 #define SURFTYPE_PROJECTION 0
210 #define SURFTYPE_REVOLUTION 8
211 #define SOLIDTYPE_REVOLUTION 1
212 
213 /*----------------------------------------------------------------------+
214 | |
215 | Bspline Flags definitions |
216 | |
217 +----------------------------------------------------------------------*/
218 #define BSPLINE_CONSTRUCTION_POLE 0
219 #define BSPLINE_CONSTRUCTION_INTERPOLATION 1
220 #define BSPLINE_CONSTRUCTION_LEASTSQUARE 2
221 
222 /*----------------------------------------------------------------------+
223 | |
224 | Elm_hdr archive flags |
225 | |
226 +----------------------------------------------------------------------*/
227 #define ELM_HDR_ARCHIVE_NEW 2
228 #define ELM_HDR_ARCHIVE_MODIFIED 1
229 
230 #if !defined (__midl) // During MIDL compile, all we care about are the values of the #define constants.
231 
232 /*----------------------------------------------------------------------+
233 | |
234 | Linkage Header - Same for all element user data |
235 | |
236 | Use LinkageUtil::GetWords/setWords to get/set linkage size. |
237 | |
238 +----------------------------------------------------------------------*/
239 struct LinkageHeader
240 {
241  UInt16 wdMantissa:8; // mantissa words: wtf if wdExponent=0
242  UInt16 wdExponent:4; // exponent for words multiplier
243  UInt16 user:1; // boolean: user data linkage
244  UInt16 modified:1; // boolean: user linkage modified
245  UInt16 remote:1; // boolean: remote linkage
246  UInt16 info:1; // boolean: informational linkage
247  UInt16 primaryID; // User ID number
248 };
249 
250 /*----------------------------------------------------------------------+
251 | |
252 | Element Header structure - common to all MicroStation elements |
253 | |
254 +----------------------------------------------------------------------*/
255 struct Elm_hdr
256 {
257  UInt16 type; // element type
258  UInt16 reserved:6; // reserved for future flags - always 0
259  UInt16 archive:2; // modified or added and not yet committed to history
260  UInt16 obsolete__:1; // was 'conflict'
261  UInt16 obsolete_2:1; // was deleted complex by header
262  UInt16 nonModel:1; // true if this element is file-specific and does not belong in any model
263  UInt16 locked:1; // element is locked
264  UInt16 isGraphics:1; // element is a graphics element, has Dsp_hdr
265  UInt16 isComplexHeader:1; // is a complex header, must have number of elements following its header
266  UInt16 complex:1; // this element is part of a complex element
267  UInt16 deleted:1; // this element is deleted
268  UInt32 elementSize; // number of words in element
269  UInt32 attrOffset; // offset (in words) from start of element to attributes
270  LevelId level; // element level
271  T_AUInt64 uniqueId; // unique ID of element
272  T_Adouble lastModified; // last time this element was changed
273 };
274 
275 /*----------------------------------------------------------------------+
276 | |
277 | Element properties word |
278 | |
279 +----------------------------------------------------------------------*/
280 struct DispHdrProperties
281  {
282  UInt16 elementClass:4; // element class
283  UInt16 reserved:1; // reserved, do not use
284  UInt16 unused2:1; // do not use
285  UInt16 unused3:1; // do not use
286  UInt16 invisible:1; // element is not displayed
287  UInt16 dynamicRange:1; // element does not have a stable range
288  UInt16 n:1; // new
289  UInt16 m:1; // modified
290  UInt16 is3d:1; // element is 3d
291  UInt16 r:1; // relative to: 0=database 1=screen
292  UInt16 p:1; // planar
293  UInt16 s:1; // 0=snappable, 1=nonsnappable
294  UInt16 h:1; // hole or solid (usually)
295  };
296 
297 /*----------------------------------------------------------------------+
298 | |
299 | Display header - Common to all displayed MicroStation elements. |
300 | |
301 | NOTE: Check ehdr.isGraphics before accessing dhdr using |
302 | element.hdr.dhdr. If ehdr.isGraphics is not set |
303 | the element is a non-graphic type that does not |
304 | have a dhdr; i.e. it's data starts right after the ehdr. |
305 | |
306 +----------------------------------------------------------------------*/
307 struct Disp_hdr
308  {
309  UInt32 grphgrp; // graphics group number
310  Int32 priority; // element display priority
311  union
312  {
313  Int16 s;
314  DispHdrProperties b;
315  } props;
316  UInt16 reserved;
317  Symbology symb;
318  ScanRange range;
319  };
320 
321 struct Header
322  {
323  Elm_hdr ehdr;
324  Disp_hdr dhdr; // NOTE: dhdr is not valid unless ehdr.isGraphics is set
325  };
326 
327 /*----------------------------------------------------------------------+
328 | |
329 | 2-D Cell Element (complex element, type 2) |
330 | |
331 +----------------------------------------------------------------------*/
332 typedef struct cell_2d
333  {
334  Elm_hdr ehdr; // element header
335  Disp_hdr dhdr; // display header
336  UInt32 componentCount; // number of elements following header
337  UInt16 classMap; // class bit map
338  struct
339  {
340  UInt16 isAnnotation:1; // is annotation cell
341  UInt16 matchSourceAnnotationSize:1; // true = when scaling, do not scale its annotations
342  UInt16 matchSourceDimValue:1; // true = when scaling, do not scale its dimension values
343  UInt16 matchSourceMultilineOffset:1; // true = when scaling, do not scale its multiline offsets
344  UInt16 reserved:12; // reserved
345  } flags;
346  DPoint2d rnglow; // extent centered on origin, low
347  DPoint2d rnghigh; // extent centered on origin, hi
348  T_Adouble transform[2][2]; // transformation matrix
349  DPoint2d origin; // cell origin
350  } Cell_2d;
351 
352 /*----------------------------------------------------------------------+
353 | |
354 | 3-D Cell Element (complex element, type 3) |
355 | |
356 +----------------------------------------------------------------------*/
357 typedef struct cell_3d
358  {
359  Elm_hdr ehdr; // element header
360  Disp_hdr dhdr; // display header
361  UInt32 componentCount; // number of elements following header
362  UInt16 classMap; // class bit map
363  struct
364  {
365  UInt16 isAnnotation:1; // is annotation cell
366  UInt16 matchSourceAnnotationSize:1; // true = when scaling, do not scale its annotations
367  UInt16 matchSourceDimValue:1; // true = when scaling, do not scale its dimension values
368  UInt16 matchSourceMultilineOffset:1; // true = when scaling, do not scale its multiline offsets
369  UInt16 reserved:12; // reserved
370  } flags;
371  DPoint3d rnglow; // extent centerd on origin, lo
372  DPoint3d rnghigh; // extent centered on origin, hi
373  T_Adouble transform[3][3]; // transformation matrix
374  DPoint3d origin; // cell origin
375  } Cell_3d;
376 
377 /*----------------------------------------------------------------------+
378 | |
379 | 2-D Line Element (type 3) |
380 | |
381 +----------------------------------------------------------------------*/
382 typedef struct line_2d
383  {
384  Elm_hdr ehdr; // element header
385  Disp_hdr dhdr; // display header
386  DPoint2d start; // starting point
387  DPoint2d end; // ending point
388  } Line_2d;
389 
390 /*----------------------------------------------------------------------+
391 | |
392 | 3-D Line Element (type 3) |
393 | |
394 +----------------------------------------------------------------------*/
395 typedef struct line_3d
396  {
397  Elm_hdr ehdr; // element header
398  Disp_hdr dhdr; // display header
399  DPoint3d start; // starting point
400  DPoint3d end; // ending point
401  } Line_3d;
402 
403 /*----------------------------------------------------------------------+
404 | |
405 | 2-D Line String Element (type 4) |
406 | |
407 | Same structure represents 2-D Shape Elements (type 6), 2-D Curve |
408 | Elements (type 11), and 2-D Conic Elements (type 13). Shapes differ|
409 | from line strings in that shape elements always start and end at |
410 | the same point. Curve and conic elements use the first and last |
411 | vertices to establish the slope at the beginning and end. |
412 | |
413 +----------------------------------------------------------------------*/
414 typedef struct line_string_2d
415  {
416  Elm_hdr ehdr; // element header
417  Disp_hdr dhdr; // display header
418  UInt32 numverts; // number of vertices
419  UInt32 reserved; // reserved
420  DPoint2d vertice[1]; // points
421  } Line_String_2d;
422 
423 /*----------------------------------------------------------------------+
424 | |
425 | 3-D Line String Element (type 4) |
426 | |
427 | See comments for 2-D Line String Element. |
428 | |
429 +----------------------------------------------------------------------*/
430 typedef struct line_string_3d
431  {
432  Elm_hdr ehdr; // element header
433  Disp_hdr dhdr; // display header
434  UInt32 numverts; // number of vertices
435  UInt32 reserved; // reserved
436  DPoint3d vertice[1]; // points
437  } Line_String_3d;
438 
439 
440 /*----------------------------------------------------------------------+
441 | |
442 | Color table element (type 5, level 1) |
443 | |
444 +----------------------------------------------------------------------*/
445 typedef struct colorTable
446  {
447  Elm_hdr ehdr; // element header
448  Int16 screen_flag; // screen flag
449  byte color_info[1]; // color table information
450  } ColorTable;
451 
452 /*----------------------------------------------------------------------+
453 | |
454 | 2-D Text Node Element (complex element, type 7) |
455 | |
456 +----------------------------------------------------------------------*/
457 typedef struct text_node_2d
458  {
459  Elm_hdr ehdr; // element header
460  Disp_hdr dhdr; // display header
461  UInt32 componentCount; // number of elements following header
462  UInt32 nodenumber; // text node number
463  UInt32 font; // text font used
464  UInt16 maxlngth; // maximum length allowed
465  UInt16 just; // justification type
466  T_Adouble linespc; // line spacing
467  T_Adouble lngthmult; // length multiplier
468  T_Adouble hghtmult; // height multiplier
469  T_Adouble rotationAngle; // rotation angle
470  DPoint2d origin; // origin
471  } Text_node_2d;
472 
473 /*----------------------------------------------------------------------+
474 | |
475 | 3-D Text Node Element (complex element, type 7) |
476 | |
477 +----------------------------------------------------------------------*/
478 // Text Node Element (note: this is a complex element)
479 typedef struct text_node_3d
480  {
481  Elm_hdr ehdr; // element header
482  Disp_hdr dhdr; // display header
483  UInt32 componentCount; // number of elements following header
484  UInt32 nodenumber; // text node number
485  UInt32 font; // text font used
486  UInt16 maxlngth; // maximum length allowed
487  UInt16 just; // justification type
488  T_Adouble linespc; // line spacing
489  T_Adouble lngthmult; // length multiplier
490  T_Adouble hghtmult; // height multiplier
491  T_Adouble quat[4]; // quaternion rotations
492  DPoint3d origin; // origin
493  } Text_node_3d;
494 
495 /*----------------------------------------------------------------------+
496 | |
497 | Design file header (type 9) |
498 | |
499 +----------------------------------------------------------------------*/
500 typedef struct dgn_header
501  {
502  Elm_hdr ehdr; // element header
503  Int16 tcbinfo[1]; // tcb information
504  } Dgn_header;
505 
506 /*----------------------------------------------------------------------+
507 | |
508 | Complex string (type 12, complex) |
509 | |
510 +----------------------------------------------------------------------*/
511 typedef struct complex_string
512  {
513  Elm_hdr ehdr; // element header
514  Disp_hdr dhdr; // display header
515  UInt32 componentCount; // number of elements following header
516  UInt32 reserved; // reserved
517  } Complex_string;
518 
519 /*----------------------------------------------------------------------+
520 | |
521 | 2-D Ellipse Element (type 15) |
522 | |
523 +----------------------------------------------------------------------*/
524 typedef struct ellipse_2d
525  {
526  Elm_hdr ehdr; // element header
527  Disp_hdr dhdr; // display header
528  T_Adouble primary; // primary axis
529  T_Adouble secondary; // secondary axis
530  T_Adouble rotationAngle; // rotation angle
531  DPoint2d origin; // origin
532  } Ellipse_2d;
533 
534 /*----------------------------------------------------------------------+
535 | |
536 | 3-D Ellipse Element (type 15) |
537 | |
538 +----------------------------------------------------------------------*/
539 typedef struct ellipse_3d
540  {
541  Elm_hdr ehdr; // element header
542  Disp_hdr dhdr; // display header
543  T_Adouble primary; // primary axis
544  T_Adouble secondary; // secondary axis
545  T_Adouble quat[4]; // quaternion rotations
546  DPoint3d origin; // origin
547  } Ellipse_3d;
548 
549 /*----------------------------------------------------------------------+
550 | |
551 | 2-D Arc Element (type 16) |
552 | |
553 +----------------------------------------------------------------------*/
554 typedef struct arc_2d
555  {
556  Elm_hdr ehdr;
557  Disp_hdr dhdr;
558  T_Adouble startAngle; // start angle
559  T_Adouble sweepAngle; // sweep angle
560  T_Adouble primary; // primary axis
561  T_Adouble secondary; // secondary axis
562  T_Adouble rotationAngle; // rotation angle
563  DPoint2d origin; // origin
564  } Arc_2d;
565 
566 /*----------------------------------------------------------------------+
567 | |
568 | 3-D Arc Element (type 16) |
569 | |
570 +----------------------------------------------------------------------*/
571 typedef struct arc_3d
572  {
573  Elm_hdr ehdr;
574  Disp_hdr dhdr;
575  T_Adouble startAngle; // start angle
576  T_Adouble sweepAngle; // sweep angle
577  T_Adouble primary; // primary axis
578  T_Adouble secondary; // secondary axis
579  T_Adouble quat[4]; // quaternion rotations
580  DPoint3d origin; // origin
581  } Arc_3d;
582 
583 /*----------------------------------------------------------------------+
584 | |
585 | 2-D Text Element (type 17) |
586 | |
587 +----------------------------------------------------------------------*/
588 typedef struct text_2d
589  {
590  Elm_hdr ehdr; // element header
591  Disp_hdr dhdr; // display header
592  UInt32 font; // text font used
593  UInt16 just; // justification type
594  UInt16 numchars; // # of characters
595  T_Adouble lngthmult; // length multiplier
596  T_Adouble hghtmult; // height multiplier
597  T_Adouble length; // total length of the text
598  T_Adouble height; // total height of the text
599  T_Adouble rotationAngle; // rotation angle of the text
600  DPoint2d origin; // origin
601  UInt16 edflds; // # of enter data fields
602  VariChar string[6]; // characters
603  } Text_2d;
604 
605 /*----------------------------------------------------------------------+
606 | |
607 | 3-D Text Element (type 17) |
608 | |
609 +----------------------------------------------------------------------*/
610 typedef struct text_3d
611  {
612  Elm_hdr ehdr; // element header
613  Disp_hdr dhdr; // display header
614  UInt32 font; // text font used
615  UInt16 just; // justification type
616  UInt16 numchars; // # of characters
617  T_Adouble lngthmult; // length multiplier
618  T_Adouble hghtmult; // height multiplier
619  T_Adouble length; // total length of the text
620  T_Adouble height; // total height of the text
621  T_Adouble quat[4]; // quaternion rotations
622  DPoint3d origin; // origin
623  UInt16 edflds; // # of enter data fields
624  VariChar string[6]; // characters
625  } Text_3d;
626 
627 /*----------------------------------------------------------------------+
628 | |
629 | Surface (type 18, complex) 3d only |
630 | |
631 +----------------------------------------------------------------------*/
632 typedef struct surface_type18
633  {
634  Elm_hdr ehdr; // element header
635  Disp_hdr dhdr; // display header
636  UInt32 componentCount; // number of elements following header
637  UInt32 boundelms; // number of boundary elements
638  UInt16 surftype; // surface type
639  UInt16 reserved[3]; // reserved
640  } Surface;
641 
642 /*----------------------------------------------------------------------+
643 | |
644 | 2-D B-Spline pole element (type 21) |
645 | |
646 +----------------------------------------------------------------------*/
647 typedef struct bspline_pole_2d
648  {
649  Elm_hdr ehdr; // element header
650  Disp_hdr dhdr; // display header
651  UInt32 numpoles; // number of poles
652  UInt32 reserved; // reserved
653  DPoint2d poles[1]; // points
654  } Bspline_pole_2d;
655 
656 /*----------------------------------------------------------------------+
657 | |
658 | 3-D B-Spline pole element (type 21) |
659 | |
660 +----------------------------------------------------------------------*/
661 typedef struct bspline_pole_3d
662  {
663  Elm_hdr ehdr; // element header
664  Disp_hdr dhdr; // display header
665  UInt32 numpoles; // number of poles
666  UInt32 reserved; // reserved
667  DPoint3d poles[1]; // points
668  } Bspline_pole_3d;
669 
670 /*----------------------------------------------------------------------+
671 | |
672 | 2-D Point String element (type 22) |
673 | |
674 +----------------------------------------------------------------------*/
675 typedef struct point_string_2d
676  {
677  Elm_hdr ehdr; // element header
678  Disp_hdr dhdr; // display header
679  UInt32 numpts; // number of points
680  UInt32 reserved; // reserved
681  DPoint2d point[1]; // points
682  } Point_string_2d;
683 
684 /*----------------------------------------------------------------------+
685 | |
686 | 3-D Point String element (type 22) |
687 | |
688 +----------------------------------------------------------------------*/
689 typedef struct point_string_3d
690  {
691  Elm_hdr ehdr; // element header
692  Disp_hdr dhdr; // display header
693  UInt32 numpts; // number of points
694  UInt32 reserved; // reserved
695  DPoint3d point[1]; // points
696  } Point_string_3d;
697 
698 /*----------------------------------------------------------------------+
699 | |
700 | Circular truncated cone (type 23) 3-D files only |
701 | |
702 +----------------------------------------------------------------------*/
703 typedef struct cone_3d
704  {
705  Elm_hdr ehdr; // element header
706  Disp_hdr dhdr; // display header
707  struct
708  {
709  UInt16 type:3; // cone type
710  UInt16 rsrv:12; // reserved
711  UInt16 surf:1; // 0 = solid, 1 = surface
712  } b;
713  UInt16 reserved[3]; // unused
714  T_Adouble quat[4]; // orientation quaternion
715  DPoint3d center_1; // center of first circle
716  T_Adouble radius_1; // radius of first circle
717  DPoint3d center_2; // center of second circle
718  T_Adouble radius_2; // radius of second cirele
719  } Cone_3d;
720 
721 /*----------------------------------------------------------------------+
722 | |
723 | Bspline flags |
724 | |
725 +----------------------------------------------------------------------*/
726 typedef struct bspline_flags
727  {
728  UInt32 order:5; // order - 2
729  UInt32 curve_display:1; // curve display flag
730  UInt32 poly_display:1; // polygon display flag
731  UInt32 rational:1; // rationalization flag
732  UInt32 closed:1; // closed curve flag
733  UInt32 curve_type:8; // curve type
734  UInt32 construct_type:4; // construction type: pole, interpolation or least square
735  UInt32 isNaturalTangents:1; // T/F: autocompute natural/bessel tangent if it's zero (open spline)
736  UInt32 isChordLenTangents:1; // T/F: scale nonzero tangent by chordlen/bessel (open spline)
737  UInt32 isColinearTangents:1; // T: adjust autocomputed tangent(s) to be colinear (geometrically closed spline)
738  UInt32 isChordLenKnots:1; // T/F: use chordlen/uniform knots (!inParams, periodic spline)
739  UInt32 isZeroStartTangent:1; // T: autocompute start tangent---ignore stored value (open spline)
740  UInt32 isZeroEndTangent:1; // T: autocompute end tangent---ignore stored value (open spline)
741  UInt32 storeFullKnots:1; // denote knot vectors that are NOT in [0.0, 1.0] range (open spline)
742  UInt32 reserved:4; // reserved
743  } Bspline_flags;
744 
745 /*----------------------------------------------------------------------+
746 | |
747 | Bspline surface flags |
748 | |
749 +----------------------------------------------------------------------*/
750 typedef struct bsurf_flags
751  {
752  UInt32 v_order:5; // b-spline order - 2 (v Direction)
753  UInt32 arcSpacing:1; // rule lines spaced by arc length
754  UInt32 v_closed:1; // closed curve flag
755  UInt32 storeFullKnots:1; // denote knot vectors that are NOT in [0.0, 1.0] range and params.closed == false
756  UInt32 reserved:24; // reserved
757  } Bsurf_flags;
758 
759 /*----------------------------------------------------------------------+
760 | |
761 | Bspline surface header (type 24) |
762 | |
763 +----------------------------------------------------------------------*/
764 typedef struct bspline_surface
765  {
766  Elm_hdr ehdr; // element header
767  Disp_hdr dhdr; // display header
768  UInt32 componentCount; // number of elements following header
769  Bspline_flags flags; // miscellaneous flags
770  UInt32 num_poles_u; // number of poles
771  UInt32 num_knots_u; // number of knots
772  UInt32 rule_lines_u; // number of rule lines
773  Bsurf_flags bsurf_flags; // bspline surface flags
774  UInt32 num_poles_v; // number of poles
775  UInt32 num_knots_v; // number of knots
776  UInt32 rule_lines_v; // number of rule lines
777  UInt32 num_bounds; // number of boundaries
778  } Bspline_surface;
779 
780 /*----------------------------------------------------------------------+
781 | |
782 | B-spline Surface boundary (type 25) |
783 | |
784 +----------------------------------------------------------------------*/
785 typedef struct bsurf_boundary
786  {
787  Elm_hdr ehdr; // element header
788  UInt32 number; // boundary number
789  UInt32 numverts; // number of boundary vertices
790  DPoint2d vertices[1]; // boundary points (in UV space)
791  } Bsurf_boundary;
792 
793 /*----------------------------------------------------------------------+
794 | |
795 | B-spline weight factor (type 26) |
796 | |
797 +----------------------------------------------------------------------*/
798 typedef struct bspline_weight
799  {
800  Elm_hdr ehdr; // element header
801  T_Adouble weights[1]; // bspline weights (variable length)
802  } Bspline_weight;
803 
804 /*----------------------------------------------------------------------+
805 | |
806 | B-spline curve header (type 27) |
807 | |
808 +----------------------------------------------------------------------*/
809 typedef struct bspline_curve
810  {
811  Elm_hdr ehdr; // element header
812  Disp_hdr dhdr; // display header
813  UInt32 componentCount; // number of elements following header
814  Bspline_flags flags; // miscellaneous flags
815  UInt32 num_poles; // number of poles
816  UInt32 num_knots; // number of knots
817  } Bspline_curve;
818 
819 /*----------------------------------------------------------------------+
820 | |
821 | B-spline knot bvector (type 28) |
822 | |
823 +----------------------------------------------------------------------*/
824 typedef struct bspline_knot
825  {
826  Elm_hdr ehdr; // element header
827  T_Adouble knots[1]; // knots (variable length)
828  } Bspline_knot;
829 
830 /*----------------------------------------------------------------------+
831 | |
832 | Shared Cell Instance (type 35) - complete definition unpublished |
833 | |
834 +----------------------------------------------------------------------*/
835 typedef struct scOverride
836  {
837  UInt16 level:1; // level override (true for pnt cells)
838  UInt16 relative:1; // relative or absolute
839  UInt16 classValue:1; // class value
840  UInt16 color:1; // color of all components
841  UInt16 weight:1; // weight of all components
842  UInt16 style:1; // style of all components
843  UInt16 assocPnt:1; // origin of cell is associative point
844  UInt16 scaleDimsWysiwyg:1; // true = when scaling, do non-default scaling of dims (scale dim sizes, don't scale dim values)
845  UInt16 unused:8;
846  } SCOverride;
847 
848 /*----------------------------------------------------------------------+
849 | |
850 | Flags structure |
851 | |
852 +----------------------------------------------------------------------*/
853 typedef union raster_flags
854  {
855  struct
856  {
857  unsigned right:1;
858  unsigned lower:1;
859  unsigned horizontal:1;
860  unsigned format:5;
861  unsigned color:1;
862  unsigned transparent:1;
863  unsigned positive:1;
864  unsigned unused:5;
865  } b;
866  Int16 s;
867  } Raster_flags;
868 
869 /*----------------------------------------------------------------------+
870 | |
871 | Raster header element (type 87) |
872 | |
873 +----------------------------------------------------------------------*/
874 typedef struct raster_hdr
875  {
876  Elm_hdr ehdr; // element header
877  Disp_hdr dhdr; // display header
878  UInt32 componentCount; // number of elements following header
879  Raster_flags flags; // miscellaneous raster data
880  byte background;
881  byte foreground;
882  UInt16 xextent;
883  UInt16 yextent;
884  Int16 reserved;
885  T_Adouble resolution;
886  T_Adouble scale;
887  DPoint3d origin;
888  UInt32 numverts;
889  UInt32 reserved2;
890  union
891  {
892  DPoint2d vert2d[1];
893  DPoint3d vert3d[1];
894  } u;
895  } Raster_hdr;
896 
897 /*----------------------------------------------------------------------+
898 | |
899 | Raster component (type 88) |
900 | |
901 +----------------------------------------------------------------------*/
902 typedef struct raster_comp
903  {
904  Elm_hdr ehdr; // element header
905  Disp_hdr dhdr; // display header
906  Raster_flags flags; // flags
907  byte background;
908  byte foreground;
909  UInt16 xoffset;
910  UInt16 yoffset;
911  UInt16 numpixels;
912  byte pixel[4];
913  } Raster_comp;
914 
915 
916 /*----------------------------------------------------------------------+
917 | |
918 | Application element (type 66, level 20) |
919 | |
920 +----------------------------------------------------------------------*/
921 typedef struct applicationElm
922  {
923  Elm_hdr ehdr;
924  Int16 signatureWord;
925  Int16 appData[1];
926  } ApplicationElm;
927 
928 /*----------------------------------------------------------------------+
929 | |
930 | Reference Attachment Element (type 100, level 0) |
931 | This is a complex element whose components are level bit masks for |
932 | each view. |
933 | |
934 +----------------------------------------------------------------------*/
935 typedef struct referenceFileElm
936  {
937  Elm_hdr ehdr; // element header
938  UInt32 componentCount; // number of elements following header
939  UInt32 version; // reference attachment version number
940  UInt32 groupId; // group number that this ref belongs to
941  UInt32 fileNumber; // file number
942  T_AUInt64 parentAttachmentId; // element id of parent attachment for copied refs
943  Fb_opts fb_opts; // file builder options mask
944  Fd_opts fd_opts; // file displayer options mask
945  UInt32 priority; // attachment display priority
946  ViewFlags displayFlags[8]; // display flags
947  UInt16 baseNestDepth; // this is retained when copying attachments
948  UInt16 reserved; // future use
949  DPoint3d refOrigin; // origin in reference uors
950  DPoint3d masterOrigin; // origin in master file uors
951  RotMatrix transform; // transformation matrix
952  T_Adouble scale; // conversion factor
953  T_Adouble reservedScale[2]; // reserved for future scaling options
954  T_Adouble zFront; // Z-front plane
955  T_Adouble zBack; // Z-back plane
956  DPoint3d cameraPosition; // Camera position
957  T_Adouble cameraFocalLength; // Camera focal length
958  UInt16 nestDepth; // nest depth
959  UInt16 reserved1; // in 8.0, this was used as dimPercent. Do not use
960  Int16 foreignUnitMode; // unused
961  UInt16 nClipPoints; // clipping vertices
962  DPoint2d clipPoints[1]; // clipping polygon
963  } ReferenceFileElm;
964 
965 
966 CLRPUBLIC struct JointDef
967  {
968  DPoint3d dir; // Unit bvector in direction of joint
969  T_Adouble scale; // Ratio of joint length to line distance
970  };
971 
972 struct MlinePoint
973  {
974  DPoint3d point;
975  struct
976  {
977  UInt16 assoc:1;
978  UInt16 roundCorner:1; // Unused - to enable corner rounding
979  UInt16 reserved:14;
980  } flags;
981  UInt16 reserved; // padding
982  UInt16 breakNo; // Starting point in break array for this segment
983  UInt16 nBreaks; // Number of breaks in this segment
984  T_Adouble radius; // For when we figure out how to round corners
985  };
986 
987 struct MlineBreak
988  {
989  UInt32 lineMask;
990  UInt32 flags;
991  T_Adouble offset;
992  T_Adouble length;
993  T_Adouble angle;
994  };
995 
996 
997 enum
998  {
999  MODELELEMENT_VERSION = 7,
1000  MIN_MODELFLAG_Properties = 0,
1001  MAX_MODELFLAG_Properties = 31,
1002  MIN_MODELFLAG_Settings = 32,
1003  MAX_MODELFLAG_Settings = 63,
1004  MODELFLAG_UseBackgroundColor = 4,
1005  };
1006 
1007 enum IsoPlaneValues {IsoPlaneTop = 0, IsoPlaneLeft, IsoPlaneRight, IsoPlaneAll};
1008 #define MAX_RGB_TRANSPARENTCOLOR 32
1009 #define MAX_CONTTONE_TRANSPARENTCOLOR 256
1010 #define MAXMASKNAMELENGTH 255 //see also MAX_MASK_NAMELENGTH in IRasterAttachment.h
1011 
1012 typedef struct _rgbColorCube
1013  {
1014  RgbColorDef colorMin;
1015  RgbColorDef colorMax;
1016  } _RGBColorCube;
1017 
1018 typedef struct _rgbTransparentColorDef
1019  {
1020  _RGBColorCube colorCube;
1021  Byte transparency; // 0...255, 0 -> Opaque.
1022  } _RGBTransparentColorDef;
1023 
1024 
1025 typedef struct _rasterTransparentColorDef
1026  {
1027  Byte index;
1028  Byte transparency; // 0...255, 0 -> Opaque.
1029  } _RasterTransparentColorDef;
1030 
1031 typedef struct _rasterRgbColorCube
1032  {
1033  RgbaColorDef colorMin;
1034  RgbaColorDef colorMax;
1035  } _RasterRGBColorCube;
1036 
1037 typedef struct _rasterRgbTransparentColorDef
1038  {
1039  _RasterRGBColorCube colorCube;
1040  Byte transparency; // 0...255, 0 -> Opaque.
1041  Byte padding[7];
1042  } _RasterRGBTransparentColorDef;
1043 
1044 typedef union _transparentColors
1045  {
1046  _RasterTransparentColorDef index[MAX_CONTTONE_TRANSPARENTCOLOR];
1047  _RasterRGBTransparentColorDef rgb[MAX_RGB_TRANSPARENTCOLOR];
1048  } RasterTransparentColors;
1049 
1050 
1051 /*---------------------------------------------------------------------------------**/
1055 CLRPUBLIC union MSElement
1056  {
1057  Elm_hdr ehdr;
1058  Header hdr; // NOTE: hdr.dhdr is not valid unless ehdr.isGraphics is set
1059  Cell_2d cell_2d;
1060  Cell_3d cell_3d;
1061  Line_2d line_2d;
1062  Line_3d line_3d;
1063  Line_String_2d line_string_2d;
1064  Line_String_3d line_string_3d;
1065  Text_node_2d text_node_2d;
1066  Text_node_3d text_node_3d;
1067  Complex_string complex_string;
1068  Ellipse_2d ellipse_2d;
1069  Ellipse_3d ellipse_3d;
1070  Arc_2d arc_2d;
1071  Arc_3d arc_3d;
1072  Text_2d text_2d;
1073  Text_3d text_3d;
1074  Point_string_2d point_string_2d;
1075  Point_string_3d point_string_3d;
1076  Cone_3d cone_3d;
1077  Surface surf;
1078  Bspline_pole_2d bspline_pole_2d;
1079  Bspline_pole_3d bspline_pole_3d;
1080  Bspline_curve bspline_curve;
1081  Bspline_surface bspline_surface;
1082  Bspline_weight bspline_weight;
1083  Bspline_knot bspline_knot;
1084  Bsurf_boundary bsurf_boundary;
1085  Raster_hdr raster_hdr;
1086  Raster_comp raster_comp;
1087  ApplicationElm applicationElm;
1088  ColorTable colorTable;
1089  ReferenceFileElm referenceFileElm;
1090  Int16 tmp[MAX_ELEMENT_WORDS];
1092 
1096  DGNPLATFORM_EXPORT size_t Size () const;
1097 
1103  DGNPLATFORM_EXPORT size_t CopyTo (MSElementR rhs) const;
1104 
1109 
1113  DGNPLATFORM_EXPORT bool IsComplexHeader () const;
1114 
1118  DGNPLATFORM_EXPORT int GetComplexComponentCount () const;
1119 
1120  }; // MSElement
1121 
1122 #endif // !defined (__midl)
1123 
1126 
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
The viewport is resized to match the exact size specifed in viewPortInfo.
UInt32 LevelId
Definition: DgnPlatformBaseType.r.h:85
#define MAX_CONTTONE_TRANSPARENTCOLOR
Definition: rastref.h:32
uint16_t UInt16
Definition: Bentley.r.h:118
union DgnPlatform::MSElement & MSElementR
Definition: DgnPlatform.h:531
struct Bentley::DgnPlatform::ScanRange ScanRange
The scan range used for mdlScanCriteria.
Definition: DgnPlatform.h:783
char VariChar
Definition: DgnElements.h:23
iterator end()
Definition: stdcxx/bstdmap.h:186
#define DGNPLATFORM_EXPORT
Definition: DgnPlatform/ExportMacros.h:58
int16_t Int16
Definition: Bentley.r.h:117
uint32_t UInt32
Definition: Bentley.r.h:128
VariChar * VariCharP
Definition: DgnElements.h:25
#define CLRPUBLIC
Definition: DgnPlatform/ExportMacros.h:12
int32_t Int32
Definition: Bentley.r.h:119
#define DGNPLATFORM_TYPEDEFS(_name_)
Definition: DgnPlatform.h:73
struct Bentley::DgnPlatform::fd_opts Fd_opts
struct Bentley::DgnPlatform::fb_opts Fb_opts
Defines typedefs and constants that can be used across other namespaces. All Bentley-authored C++ sou...
unsigned char byte
Definition: Bentley.r.h:144
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
#define MAX_RGB_TRANSPARENTCOLOR
Definition: rastref.h:31
UInt64 ElementId
Definition: DgnPlatformBaseType.r.h:83
VariChar const * VariCharCP
Definition: DgnElements.h:24
unsigned char Byte
Definition: Bentley.r.h:143
Provides a list of language code page value settings (Bentley/CodePages.h).

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.