CGM Objects Library
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
CgmIn.h
1 // CgmIn.h: interface for the CCgmIn class.
2 //
5 #ifdef WIN32
6 #pragma warning( disable : 4996; disable : 4995 )
7 #endif
8 
9 #if !defined(AFX_CGMI_H__5C7E1AE9_8086_4467_926F_04D6BE0C18BC__INCLUDED_)
10 #define AFX_CGMI_H__5C7E1AE9_8086_4467_926F_04D6BE0C18BC__INCLUDED_
11 
12 #pragma once
13 
14 #include <stack>
15 #include <string>
16 
17 #include "CgmDecode.h"
18 #include "Figure.h"
19 #include "Segment.h"
20 #include "Path.h"
21 #include "Clipping.h"
22 #include "AppStruct.h"
23 #include "DrawBase.h"
24 #include "Utility/FPoint.h"
25 #include "Utility/wstring.h"
26 
27 
28 namespace Larson
29 {
30  #define MAX_FONTS 256
31  #define MAX_FONT_NAME_LEN 256 /* maxmimum number characters in font name */
32  #define MAX_CHARSETS 8
33  #define MAX_TEXT_SCORE_TYPES 4
34  #define MAX_BUNDLES 32
35  #define MAX_PROT_REGIONS 1024 /* maximum allowable protections regions */
36 
37  class Parser;
38 
40  class CCgmIn
41  {
42  enum MajorState {
43  MCS = -1,
44  MDS = 0,
45  PCS = 1,
46  DR = 2,
47  GSS = 3,
48  DSS = 4,
49  PDS = 5,
50  POS = 6,
51  LSS = 7,
52  SDS = 8,
53  SOS = 9
54  };
55 
56  enum MinorState {
57  MNS_inactive = 0,
58  MNS_active
59  };
60 
61 #if 0
62  enum FID_identifier {
63  FID_begin_metafile = 0,
64  FID_end_metafile,
65  FID_begin_picture,
66  FID_begin_picture_body,
67  FID_end_picture,
68  FID_begin_segment,
69  /* note jump 6 */
70  FID_end_segment = 7,
71  FID_begin_figure,
72  FID_end_figure,
73  FID_begin_protection_region,
74  FID_end_protection_region,
75  FID_begin_compound_line,
76  FID_end_compound_line,
77  FID_begin_compound_text_path,
78  FID_end_compound_text_path,
79  FID_begin_tile_array,
80  FID_end_tile_array,
81  FID_metafile_version,
82  FID_metafile_description,
83  FID_vdc_type,
84  FID_integer_precision,
85  FID_real_precision,
86  FID_index_precision,
87  FID_color_precision,
88  FID_color_index_precision,
89  FID_maximum_color_index,
90  FID_color_value_extent,
91  FID_metafile_elements_list,
92  FID_metafile_defaults_replacement,
93  FID_font_list,
94  FID_character_set_list,
95  FID_character_coding_announcer,
96  FID_name_precision,
97  FID_maximum_vdc_extent,
98  FID_segment_priority_extent,
99  FID_color_model,
100  FID_color_calibration,
101  FID_font_properties,
102  FID_glyph_mapping,
103  FID_symbol_library_list,
104  FID_scaling_mode,
105  FID_color_selection_mode,
106  /* note jump 43 */
107  FID_line_width_specification_mode = 44,
108  /* note jump 45 */
109  FID_marker_size_specification_mode = 46,
110  /* note jump 47 */
111  FID_edge_width_specification_mode = 48,
112  /* note jump 49 */
113  FID_vdc_extent = 50,
114  FID_background_color,
115  FID_device_viewport,
116  FID_device_viewport_mapping,
117  FID_device_viewport_specification_mode,
118  FID_line_representation,
119  FID_marker_representation,
120  FID_text_representation,
121  FID_fill_representation,
122  FID_edge_representation,
123  FID_interior_style_specification_mode,
124  FID_line_edge_type_definition,
125  FID_hatch_style_definition,
126  FID_geometric_pattern_definition,
127  FID_vdc_integer_precision,
128  FID_vdc_real_precision,
129  FID_auxiliary_color,
130  FID_transparency,
131  FID_clip_rectangle,
132  FID_clip_indicator,
133  FID_line_clipping_mode,
134  FID_marker_clipping_mode,
135  FID_edge_clipping_mode,
136  FID_new_region,
137  FID_save_primitive_context,
138  FID_restore_primitive_context,
139  FID_protection_region_indicator,
140  FID_generalized_text_path_mode,
141  FID_mitre_limit,
142  FID_transparent_cell_color,
143  FID_polyline,
144  FID_disjoint_polyline,
145  FID_polymarker,
146  FID_text,
147  FID_restricted_text,
148  FID_append_text,
149  FID_polygon,
150  FID_polygon_set,
151  FID_cell_array,
152  FID_generalized_drawing_primitive,
153  FID_rectangle,
154  FID_circle,
155  FID_circular_arc_3_point,
156  FID_circular_arc_3_point_close,
157  FID_circular_arc_center,
158  FID_circular_arc_center_close,
159  FID_ellipse,
160  FID_elliptical_arc,
161  FID_elliptical_arc_close,
162  FID_circular_arc_center_reversed,
163  FID_connecting_edge,
164  FID_hyperbolic_arc,
165  FID_parabolic_arc,
166  FID_non_uniform_b_spline,
167  FID_non_uniform_rational_b_spline,
168  FID_polybezier,
169  FID_polysymbol,
170  FID_bitonal_tile,
171  FID_tile,
172  FID_line_bundle_index,
173  FID_line_type,
174  FID_line_width,
175  FID_line_color,
176  FID_marker_bundle_index,
177  FID_marker_type,
178  FID_marker_size,
179  FID_marker_color,
180  FID_text_bundle_index,
181  FID_font_index,
182  FID_text_precision,
183  FID_character_expansion_factor,
184  FID_character_spacing,
185  FID_text_color,
186  FID_character_height,
187  FID_character_orientation,
188  FID_text_path,
189  FID_text_alignment,
190  FID_character_set_index,
191  FID_alternate_character_set_index,
192  FID_fill_bundle_index,
193  FID_interior_style,
194  FID_fill_color,
195  FID_hatch_index,
196  FID_pattern_index,
197  FID_edge_bundle_index,
198  FID_edge_type,
199  FID_edge_width,
200  FID_edge_color,
201  FID_edge_visibility,
202  FID_fill_reference_point,
203  FID_pattern_table,
204  /* note jump 141 */
205  FID_pattern_size = 142,
206  FID_color_table,
207  /* note jump 144 */
208  FID_aspect_source_flags = 145,
209  FID_pick_identifier,
210  FID_line_cap,
211  FID_line_join,
212  FID_line_type_continuation,
213  FID_line_type_initial_offset,
214  FID_text_score_type,
215  FID_restricted_text_type,
216  FID_interpolated_interior,
217  FID_edge_cap,
218  FID_edge_join,
219  FID_edge_type_continuation,
220  FID_edge_type_initial_offset,
221  FID_symbol_library_index,
222  FID_symbol_color,
223  FID_symbol_size,
224  FID_symbol_orientation,
225  FID_escape,
226  FID_message,
227  FID_application_data,
228  FID_copy_segment,
229  FID_inheritance_filter,
230  FID_clip_inheritance,
231  FID_segment_transformation,
232  FID_segment_highlighting,
233  FID_segment_display_priority,
234  FID_segment_pick_priority,
235  FID_begin_application_structure,
236  FID_begin_application_structure_body,
237  FID_end_application_structure,
238  FID_application_structure_attribute
239  };
240 #else
241 #define FID_begin_metafile 0
242 #define FID_end_metafile FID_begin_metafile+1
243 #define FID_begin_picture FID_end_metafile+1
244 #define FID_begin_picture_body FID_begin_picture+1
245 #define FID_end_picture FID_begin_picture_body+1
246 #define FID_begin_segment FID_end_picture+1
247 /* note jump 6 */
248 #define FID_end_segment FID_begin_segment+2
249 #define FID_begin_figure 8
250 #define FID_end_figure 9
251 #define FID_begin_protection_region 10
252 #define FID_end_protection_region 11
253 #define FID_begin_compound_line 12
254 #define FID_end_compound_line 13
255 #define FID_begin_compound_text_path 14
256 #define FID_end_compound_text_path 15
257 #define FID_begin_tile_array 16
258 #define FID_end_tile_array 17
259 #define FID_metafile_version 18
260 #define FID_metafile_description 19
261 #define FID_vdc_type 20
262 #define FID_integer_precision 21
263 #define FID_real_precision 22
264 #define FID_index_precision 23
265 #define FID_color_precision 24
266 #define FID_color_index_precision 25
267 #define FID_maximum_color_index 26
268 #define FID_color_value_extent 27
269 #define FID_metafile_elements_list 28
270 #define FID_metafile_defaults_replacement 29
271 #define FID_font_list 30
272 #define FID_character_set_list 31
273 #define FID_character_coding_announcer 32
274 #define FID_name_precision 33
275 #define FID_maximum_vdc_extent 34
276 #define FID_segment_priority_extent 35
277 #define FID_color_model 36
278 #define FID_color_calibration 37
279 #define FID_font_properties 38
280 #define FID_glyph_mapping 39
281 #define FID_symbol_library_list 40
282 #define FID_scaling_mode 41
283 #define FID_color_selection_mode 42
284 /* note jump 43 */
285 #define FID_line_width_specification_mode 44
286 /* note jump 45 */
287 #define FID_marker_size_specification_mode 46
288 /* note jump 47 */
289 #define FID_edge_width_specification_mode 48
290 /* note jump 49 */
291 #define FID_vdc_extent 50
292 #define FID_background_color 51
293 #define FID_device_viewport 52
294 #define FID_device_viewport_mapping 53
295 #define FID_device_viewport_specification_mode 54
296 #define FID_line_representation 55
297 #define FID_marker_representation 56
298 #define FID_text_representation 57
299 #define FID_fill_representation 58
300 #define FID_edge_representation 59
301 #define FID_interior_style_specification_mode 60
302 #define FID_line_edge_type_definition 61
303 #define FID_hatch_style_definition 62
304 #define FID_geometric_pattern_definition 63
305 #define FID_vdc_integer_precision 64
306 #define FID_vdc_real_precision 65
307 #define FID_auxiliary_color 66
308 #define FID_transparency 67
309 #define FID_clip_rectangle 68
310 #define FID_clip_indicator 69
311 #define FID_line_clipping_mode 70
312 #define FID_marker_clipping_mode 71
313 #define FID_edge_clipping_mode 72
314 #define FID_new_region 73
315 #define FID_save_primitive_context 74
316 #define FID_restore_primitive_context 75
317 #define FID_protection_region_indicator 76
318 #define FID_generalized_text_path_mode 77
319 #define FID_mitre_limit 78
320 #define FID_transparent_cell_color 79
321 #define FID_polyline 80
322 #define FID_disjoint_polyline 81
323 #define FID_polymarker 82
324 #define FID_text 83
325 #define FID_restricted_text 84
326 #define FID_append_text 85
327 #define FID_polygon 86
328 #define FID_polygon_set 87
329 #define FID_cell_array 88
330 #define FID_generalized_drawing_primitive 89
331 #define FID_rectangle 90
332 #define FID_circle 91
333 #define FID_circular_arc_3_point 92
334 #define FID_circular_arc_3_point_close 93
335 #define FID_circular_arc_center 94
336 #define FID_circular_arc_center_close 95
337 #define FID_ellipse 96
338 #define FID_elliptical_arc 97
339 #define FID_elliptical_arc_close 98
340 #define FID_circular_arc_center_reversed 99
341 #define FID_connecting_edge 100
342 #define FID_hyperbolic_arc 101
343 #define FID_parabolic_arc 102
344 #define FID_non_uniform_b_spline 103
345 #define FID_non_uniform_rational_b_spline 104
346 #define FID_polybezier 105
347 #define FID_polysymbol 106
348 #define FID_bitonal_tile 107
349 #define FID_tile 108
350 #define FID_line_bundle_index 109
351 #define FID_line_type 110
352 #define FID_line_width 111
353 #define FID_line_color 112
354 #define FID_marker_bundle_index 113
355 #define FID_marker_type 114
356 #define FID_marker_size 115
357 #define FID_marker_color 116
358 #define FID_text_bundle_index 117
359 #define FID_font_index 118
360 #define FID_text_precision 119
361 #define FID_character_expansion_factor 120
362 #define FID_character_spacing 121
363 #define FID_text_color 122
364 #define FID_character_height 123
365 #define FID_character_orientation 124
366 #define FID_text_path 125
367 #define FID_text_alignment 126
368 #define FID_character_set_index 127
369 #define FID_alternate_character_set_index 128
370 #define FID_fill_bundle_index 129
371 #define FID_interior_style 130
372 #define FID_fill_color 131
373 #define FID_hatch_index 132
374 #define FID_pattern_index 133
375 #define FID_edge_bundle_index 134
376 #define FID_edge_type 135
377 #define FID_edge_width 136
378 #define FID_edge_color 137
379 #define FID_edge_visibility 138
380 #define FID_fill_reference_point 139
381 #define FID_pattern_table 140
382 /* note jump 141 */
383 #define FID_pattern_size 142
384 #define FID_color_table 143
385 /* note jump 144 */
386 #define FID_aspect_source_flags 145
387 #define FID_pick_identifier 146
388 #define FID_line_cap 147
389 #define FID_line_join 148
390 #define FID_line_type_continuation 149
391 #define FID_line_type_initial_offset 150
392 #define FID_text_score_type 151
393 #define FID_restricted_text_type 152
394 #define FID_interpolated_interior 153
395 #define FID_edge_cap 154
396 #define FID_edge_join 155
397 #define FID_edge_type_continuation 156
398 #define FID_edge_type_initial_offset 157
399 #define FID_symbol_library_index 158
400 #define FID_symbol_color 159
401 #define FID_symbol_size 160
402 #define FID_symbol_orientation 161
403 #define FID_escape 162
404 #define FID_message 163
405 #define FID_application_data 164
406 #define FID_copy_segment 165
407 #define FID_inheritance_filter 166
408 #define FID_clip_inheritance 167
409 #define FID_segment_transformation 168
410 #define FID_segment_highlighting 169
411 #define FID_segment_display_priority 170
412 #define FID_segment_pick_priority 171
413 #define FID_begin_application_structure 172
414 #define FID_begin_application_structure_body 173
415 #define FID_end_application_structure 174
416 #define FID_application_structure_attribute 175
417 #endif
418 
419  public:
420 
421  typedef struct CGMI_NORM_RGB {
422  double red, green, blue;
423  } CGMI_NORM_RGB;
424 
425  typedef unsigned long CGMI_COLREF; // Packed RGB starting in most significant byte
426  // the lowest byte is reserved for Alpha
427 
428  typedef struct /* COLOR attribute setting
429  if index >= 0 this is a color index
430  if index = -1 then current color is direct */
431  CGMI_CO_BUNDLE {
432  long index; /* current color index */
433  CColor direct; /* current direct color, if index -1 */
434  long mode;
435  } CGMI_CO_BUNDLE;
436 
437  typedef struct CGMI_TSTYPE {
438  long type;
439  long indicator;
440  } CGMI_TSTYPE;
441 
442 
443  typedef struct CGMI_sCharSet {
444  long type;
445  wchar_t *tail;
446  long encoding;
447  } CGMI_sCharSet;
448 
449  typedef struct CGMI_LEM_BUNDLE { // line, edge or marker representation bundle
450  long type;
451  double scale;
452  long specMode;
453  CGMI_CO_BUNDLE color;
454  long defined;
455  } CGMI_LEM_BUNDLE;
456 
457  // define TRACE Attributes (both Plus and PIP)
458  #define TRACE_ConstantColr 0
459  #define TRACE_VariantColr 1 /*?*/
460  #define TRACE_off 0
461  #define TRACE_edge 0
462  #define TRACE_right 0
463  #define TRACE_highest 0
464  #define TRACE_lowest 1
465  #define TRACE_not_final 0
466 
467  #define FT_W 1
468  #define FT_VAPOS 2
469  #define FT_VANEG 4
470  #define FT_BGRCT 8
471  #define FT_BGINT 16
472  #define FT_VAPOS_C 32
473  #define FT_VANEG_C 64
474 
475  #define DATA_MUX 4
476 
477  #define DATA_I2 0
478  #define DATA_I4 1
479  #define DATA_R4 2
480  #define DATA_I1 3
481  #define DATA_I2MUX 4
482  #define DATA_I1MUX 5
483 
484 
485  typedef struct {
486  // begin attributes
487  FPoint orientation_baseline,
488  orientation_amplitude;
489  float baseline_scale,
490  amplitude_scale;
491  char display_mode_wiggle,
492  display_mode_positive_va_fill,
493  display_mode_negative_va_fill,
494  display_mode_background_fill;
495  char resampling_method;
496  long maximum_number_of_samples;
497  struct {
498  float pos, neg;
499  } wiggle_amplitude_limit;
500  char wiggle_line_type_mode;
501  struct {
502  float min, max;
503  } positive_va_fill_boundaries;
504  struct {
505  float min, max;
506  } negative_va_fill_boundaries;
507  char rectified_va_fill_mode;
508  char va_fill_style;
509  struct {
510  CGMI_CO_BUNDLE pos, neg;
511  } va_fill_constant_colour;
512  struct {
513  long pos, neg;
514  } va_fill_constant_pattern;
515  char va_fill_alignment;
516  char va_fill_var_colour_selection;
517  struct {
518  float factor, bias;
519  long min, max;
520  } va_fill_var_linear;
521  struct {
522  float pos, neg;
523  } background_fill_boundaries;
524  char background_colour_interpolation_mode;
525  char background_fill_style;
526  struct {
527  char indicator;
528  CGMI_CO_BUNDLE colour;
529  } background_null_colour;
530  CGMI_CO_BUNDLE background_fill_constant_colour;
531  char background_fill_alignment;
532  char background_fill_var_colour_selection;
533  struct {
534  float factor, bias;
535  long min, max;
536  } background_fill_var_linear;
537  // end attributes
538 
539  /* object to hold current attributes saved off... (for group and old style traces) */
540  CCgmTrace *pCgmTrace;
541 
542  } TRACE_DP;
543 
544  typedef struct {
545  long init;
546  TRACE_DP defered,
547  group_info;
548  long group_identifier;
549  char positive_lobe_display_priority,
550  negative_lobe_display_priority,
551  positive_lobe_pixel_drawing_mode,
552  negative_lobe_pixel_drawing_mode;
553  float data_complete_coordinate;
554  long data_complete_flag;
555  long rendering_direction;
556 
557  long group_count;
558 
559  struct
560  {
561  float ndc_origin_x, ndc_origin_y,
562  ndc_step_x, ndc_step_y;
563  long mux_dat,
564  trace_group_offset,
565  max_num_samples,
566  stype,
567  wiggle_display_modulus,
568  wiggle_left_to_modulus,
569  traces_per_location,
570  traces_left_at_location,
571  trace_filter, trace_left_to_filter;
572  long fifo;
573  long first_data_after_init;
574  } old;
575 
576  ClipRectangle* clipRectangle;
577  ClippingPath* clippingPath;
578  unsigned char transparency;
579 
580  CColorReps* pColorReps;
581 
582  } TRACE_ATTR;
583 
584  CCgmIn(std::string inputFile, int iPicture, CCgmObjects* pCgmObjects,
585  std::vector<CgmInError> *pErrorList = NULL, bool enableErrChecking = true);
586  CCgmIn(std::wstring inputFile, int iPicture, CCgmObjects* pCgmObjects,
587  std::vector<CgmInError> *pErrorList = NULL, bool enableErrChecking = true);
588  ~CCgmIn();
589 
590  long m_error;
591 
593  struct CGMI_MD
594  {
595  long metafileVersion;
596  std::vector<std::wstring> metafileDescription; // list to allow for multiples
597  wchar_t *metafileId; // BEGIN METAFILE identifier
598  unsigned char *metafileIdData; // raw metafile id byte data
599  int metafileIdDataSize; // raw metafile id byte data size in bytes
600 
601  struct { /* COLOR VALUE EXTENT */
602  CGMI_NORM_RGB min;
603  CGMI_NORM_RGB max;
604  } colorExtent;
605 
606  CGMI_DS metafileDefRep; /* METAFILE DEFAULTS REPLACEMENT */
607  /* pointer to MDR data record(s) */
608  CGMI_FMTBL metafileDefFmtbl; // format table containing data types at point where MDR occured
609  CGMI_DS globalSegments; /* Global Segments */
610  /* pointer to GS data record(s) */
611  CGMI_FMTBL format;
612 
613  vector<std::wstring> fontlist;
614  vector<CFontProperties*> fontProperties;
615 
616  CGMI_sCharSet characterSetList[MAX_CHARSETS];
617  long characterCodingAnn;
618  long bSiSo; /* allow Shift In/Out in text strings */
619 
620  DPoint maxVdcExtent[2];
621 
622  long maximumColorIndex;
623  CSegment* activeGlobalSegment;
624 
625  } m_MD;
626 
628  struct CGMI_PD
629  {
630  wchar_t* pictureId;
631 
634 
637 
640 
648  DPoint vdcExtent[2];
649 
652 
654  DPoint deviceViewport[2];
656  struct {
657  long vcSpecifier; /* VC specifier */
658  double metricScaleFactor; /* metric scale factor */
660 
663  {
664  long isotropy; /* isotropy flag */
665  long horizontalAlignment; /* horizontal alignment flag */
666  long verticalAlignment; /* vertical alignment flag */
667  } deviceVPMappingOff;
668 
675  {
676  long fontIndex;
677  long precision;
678  double spacing;
679  double expFactor;
680  CGMI_CO_BUNDLE color;
681  long defined;
682  } textBundles[MAX_BUNDLES];
685  {
686  long type;
687  long hatchIndex;
688  long patternIndex;
689  CGMI_CO_BUNDLE color;
690  long defined;
691  } fillBundles[MAX_BUNDLES];
694 
695  long interiorStyleSpecMode;
696 
697  VDC_PRECISIONS vdcPrecisions;
698  } m_PD;
699 
701  typedef struct
702  {
703  unsigned char asfLineType;
704  unsigned char asfLineWidth;
705  unsigned char asfLineColor;
706  unsigned char asfMarkerType;
707  unsigned char asfMarkerSize;
708  unsigned char asfMarkerColor;
709  unsigned char asfTextFontIndex;
710  unsigned char asfTextPrecision;
711  unsigned char asfTextColor;
712  unsigned char asfCharacterExpFactor;
713  unsigned char asfCharacterSpacing;
714  unsigned char asfFillInteriorStyle;
715  unsigned char asfFillColor;
716  unsigned char asfFillHatchIndex;
717  unsigned char asfFillPatternIndex;
718  unsigned char asfEdgeType;
719  unsigned char asfEdgeWidth;
720  unsigned char asfEdgeColor;
721  } CGMI_ASFS;
722 
724  struct CGMI_ATTR // Picture Attributes
725  {
726  Path* compoundTextPath;
727  Path* activePath;
728  long altCharacterSetIndex;
729  long altCharacterSetEncoding;
730  CAppStruct* pAppStruct;
731 
734 
735  CGMI_CO_BUNDLE auxColor;
736 
737  double characterHeight;
738  struct {
739  DPoint up, base;
740  } characterOrientation;
741  double characterExpFactor;
742  double characterSpacing;
743  long characterSetIndex;
744  long characterSetEncoding;
745 
746  long clipInheritance;
747  long clipIndicator;
748  DPoint clipRectangle[2];
749  long clipRectIndex;
750 
751  struct {
752  unsigned long color;
753  char lineType;
754  double lineWidth;
755  } compoundLineAttr;
756 
757  long currentTileNumber;
758 
759  long drawMode; /* current drawing mode */
760 
761  long edgeClippingMode;
762  long edgeType;
763 
764  double edgeWidth;
765 
766  CGMI_CO_BUNDLE edgeColor;
767  long edgeCap;
768  long edgeDashCap;
769  long edgeJoin;
770  long edgeTypeCont;
771  float edgeTypeInitOff;
772  long edgeBundleIndex;
773  long edgeVisibility;
774 
775  CFigure *figureActive;
776  long fillBundleIndex;
777  long fillInteriorStyle;
778  CGMI_CO_BUNDLE fillColor;
779 
780  long generalizedTextPathMode;
781  long geometricPatternIndex;
782 
783  long hatchIndex;
784  struct {
785  char newFlag;
786  long Style;
787  double RefGeom[4]; // raw reference geom
788  long nStages; // number of stages
789  double *StageDesignators;
790  CGMI_CO_BUNDLE *StageColors;
791  } interpInteriorStruct;
792  CInterpInteriorParams* pCurrentInterpInteriorParams;
793 
794  long lineBundleIndex;
795  long lineType;
796  long lineCap;
797  long lineDashCap;
798  long lineJoin;
799  long lineTypeCont;
800  float lineTypeInitOff;
801 
802  double lineWidth;
803 
804  CGMI_CO_BUNDLE lineColor;
805  long lineClippingMode;
806 
807  long markerBundleIndex;
808  long markerType;
809 
810  double markerSize;
811 
812  CGMI_CO_BUNDLE markerColor;
813  long markerClippingMode;
814 
815  long maxFontIndex;
816 
817  float mitreLimit;
818 
819  long patternIndex;
820  struct {
821  DPoint height;
822  DPoint width;
823  } patternSize;
824  DPoint patternRefPoint;
825 
826  long protRegionIndex;
827  long protRegionIndicator;
828 
829  long textBundleIndex;
830  long textFontIndex;
831  CGMI_CO_BUNDLE textColor;
832  long textPath;
833  struct {
834  long hor, ver;
835  } textAlignment;
836 
837  struct {
838  double hor, ver;
839  } textAlignmentCont;
840 
841  long textPrecision;
842  vector<CGMI_TSTYPE> textScoreTypes;
843 
844  CSegment* activeSegment;
845 
846  long symbolLibraryIndex;
847  DPoint symbolOrientation[2];
848  CGMI_CO_BUNDLE symbolColor;
849  long symbolSizeIndicator;
850  double symbolSize[2];
851 
852  long restrictedTextType;
853  CGMI_CO_BUNDLE transparentCellColor;
854  long transparentCellIndicator;
855  long transparency;
856 
857  CCgmTileArray* pTileArray;
858 
859  CCgmText* pAppendParent;
860 
861  TRACE_ATTR traceAttr;
862  float alphaTransparency;
863 
864  long escapeFunctionId;
865 
866  long aciLineEdgeTypeOverides;
867  long aciLineEdgeTypes[5]; // aci standard (1-5)line type re-def
868 
869  long aciHatchStyleOverides;
870  long aciHatchStyles[6]; // aci standard (1-6) hatch index re-def
871 
872  short ataLayerNumber;
873  } m_Attr;
874 
876  struct CGMI_ATTRX // Picture Attributes
877  {
878  double lineWidthScaled;
879  double lineWidthAbsolute;
880  double lineWidthMM;
881  double lineWidthFractional;
882 
883  double markerSizeScaled;
884  double markerSizeAbsolute;
885  double markerSizeMM;
886  double markerSizeFractional;
887 
888  double edgeWidthScaled;
889  double edgeWidthAbsolute;
890  double edgeWidthMM;
891  double edgeWidthFractional;
892  } m_AttrExt;
893 
895  typedef struct // Primitive Context
896  {
897  long primitiveContextName;
898 
899  long altCharacterSetIndex;
900 
903 
904  CGMI_CO_BUNDLE auxColor;
905 
906  double characterHeight;
907  struct {
908  DPoint up, base;
909  } characterOrientation;
910  double characterExpFactor;
911  double characterSpacing;
912  long characterSetIndex;
913 
914  long clipIndicator;
915  DPoint clipRectangle[2];
916 
917  long edgeClippingMode;
918  long edgeType;
919 
920  double edgeWidthScaled;
921  double edgeWidthAbsolute;
922  double edgeWidthMM;
923  double edgeWidthFractional;
924 
925  CGMI_CO_BUNDLE edgeColor;
926  long edgeCap;
927  long edgeJoin;
928  long edgeTypeCont;
929  float edgeTypeInitOff;
930  long edgeBundleIndex;
931  long edgeVisibility;
932 
933  long fillBundleIndex;
934  long fillInteriorStyle;
935  CGMI_CO_BUNDLE fillColor;
936 
937  long hatchIndex;
938  struct {
939  char newFlag;
940  long Style;
941  double RefGeom[4]; // raw reference geom
942  long nStages; // number of stages
943  double *StageDesignators;
944  CGMI_CO_BUNDLE *StageColors;
945  } interpInteriorStruct;
946 
947  long lineBundleIndex;
948  long lineType;
949  long lineCap;
950  long lineJoin;
951  long lineTypeCont;
952  float lineTypeInitOff;
953 
954  double lineWidthScaled;
955  double lineWidthAbsolute;
956  double lineWidthMM;
957  double lineWidthFractional;
958 
959  CGMI_CO_BUNDLE lineColor;
960  long lineClippingMode;
961 
962  long markerBundleIndex;
963  long markerType;
964 
965  double markerSizeScaled;
966  double markerSizeAbsolute;
967  double markerSizeMM;
968  double markerSizeFractional;
969 
970  CGMI_CO_BUNDLE markerColor;
971  long markerClippingMode;
972 
973  float mitreLimit;
974 
975  long patternIndex;
976  struct {
977  DPoint height;
978  DPoint width;
979  } patternSize;
980  DPoint patternRefPoint; // aka fillRefPoint
981 
982  long protRegionIndicator;
983  ClippingPath *protRegion; // = LinkCurClippingPath();
984 
985  long textBundleIndex;
986  long textFontIndex;
987  CGMI_CO_BUNDLE textColor;
988  long textPath;
989  struct {
990  long hor, ver;
991  } textAlignment;
992 
993  long textPrecision;
994  vector<CGMI_TSTYPE> textScoreTypes;
995 
996  long symbolLibraryIndex;
997  DPoint symbolOrientation[2];
998  CGMI_CO_BUNDLE symbolColor;
999  long symbolSizeIndicator;
1000  double symbolSize[2];
1001 
1002  long restrictedTextType;
1003  long transparency;
1004 
1005  long pickIdentifier;
1006 
1007  } PrimitiveContext;
1008 
1010  vector<PrimitiveContext> m_primitiveContext;
1011 
1013  vector<ClippingPath::ProtRegion> m_protRegData;
1014 
1015  /* Major State */
1016  MajorState state; // metafile major state
1017  MajorState prevState;
1018 
1019  /* minor states */
1020  MinorState figState;
1021  MinorState textState;
1022  MinorState ptregState;
1023  MinorState cplineState;
1024  MinorState cptxpath;
1025  MinorState tileArrayState;
1026 
1027  private:
1028  void memset__m_MD();
1029  void memset__m_Attr();
1030  void InitClassVariables();
1031 
1032  void LogError(long klass, long element);
1033  void OpenParse(std::wstring inputFile, int iPicture, CCgmObjects* pCgmObjects, std::vector<CgmInError> *pErrorList);
1034  long ProtRegDataIndex(long index, bool replace);
1035  ClippingPath* LinkCurClippingPath();
1036  ClipRectangle* LinkCurClipRectangle();
1037  long _AppStructureDescriptorElements(CGMI_DS * cgmi_ds, long element, long count);
1038  long _DelimiterElements(CGMI_DS *cgmi_ds, long element);
1039  long _MDElements(CGMI_DS *cgmi_ds, long element, long count);
1040  long _PDElements(CGMI_DS *cgmi_ds, long element, long count);
1041  long _ControlElements(CGMI_DS *cgmi_ds, long element);
1042  long _PrimitiveElements(CGMI_DS *cgmi_ds, long element, long count);
1043  long _GDPElements(CGMI_DS *cgmi_ds, long element, long count);
1044  long _AttributeElements(CGMI_DS *cgmi_ds, long element, long count);
1045  long _EscapeElements(CGMI_DS *cgmi_ds, long element);
1046  long _ExternalElements(CGMI_DS *cgmi_ds, long element);
1047  long _SegmentElements(CGMI_DS * cgmi_ds, long element);
1048  void AddElement(CCgmBaseObj* pObj);
1049  long charsetlist(CGMI_DS *cgmi_ds, long count);
1050  long parseFontlist(CGMI_DS *cgmi_ds, long count);
1051  long valColor(unsigned long *ca, CGMI_CO_BUNDLE *setting, long colorSelectionMode = -1);
1052  void getLineAttr(CCgmBaseObj* pObj);
1053  void getFillAttr(CCgmBaseObj* pObj);
1054  long cellArray(CGMI_DS *cgmi_ds);
1055  long tile(CGMI_DS *cgmi_ds, long element);
1056  long capturePoints(DPoint *pts, long nPts, Path::ePathType pathType, bool closed);
1057  long capturePGSet(DPoint *pts, long nPts, unsigned char* edges);
1058  long endFigure();
1059  CFigure::edgeAttr* getEdgeAttrIfVisibleAndDiff();
1060 
1061  long plusInit(CGMI_DS *cgmi_ds);
1062  long plusTrace(CGMI_DS *cgmi_ds);
1063  long pipEscapes(CGMI_DS *cgmi_ds, long escapeId);
1064  long pipTrace(CGMI_DS *cgmi_ds);
1065  long pipDeriveColors (
1066  float factor, float bias, long minci, long maxci,
1067  float *sample_list, long sample_list_length,
1068  float sample_normalization_extent,
1069  unsigned long **derived_colors_list, long *derived_colors_list_length);
1070 
1071  //boost::mutex m_cgminMutex;
1072  Parser* pParser;
1073  CCgmTrace* m_pLastTrace;
1074  std::wstring m_inputFile;
1075  int currentPicture;
1076  ClippingPath* m_curClippingPath;
1077  ClipRectangle* m_curClipRectangle;
1078  bool m_logError;
1079  CCgmObjects* m_pCgmObjects;
1080 
1081  bool validPt(DPoint pt);
1082  double validDouble(double dValue, double defVal);
1083 
1084  int unrecognizedElements;
1085  bool autoCorrect;
1086  int autoAPSIdNumber; // used for renumbering APS ids
1087 
1090  double m_defVDCextDx;
1091  double m_defVDCextDy;
1092  int isActiveCGM; // 0= not, 1= InterCAP Author, 2= Corel ActiveCGM
1093  void endActiveCgmAppDataGroup();
1094  };
1095 };
1096 #endif // !defined(AFX_CGMI_H__5C7E1AE9_8086_4467_926F_04D6BE0C18BC__INCLUDED_)
CGMI_ASFS aspectSourceFlags
Aspect Source Flags 0= off 1= on.
Definition: CgmIn.h:902
ClipRectangle – Clipping rectangle data container class.
Definition: Clipping.h:44
Retains CGM Picture Descriptor data while a CGM is being loaded.
Definition: CgmIn.h:628
ClippingPath – ClippingPath data container class.
Definition: Clipping.h:19
CSegment – Segment class- a segment is a list of picture elements.
Definition: Segment.h:7
long edgeWidthSpecMode
picture edge width specfication mode: absolute, scaled, fractional, mm; default: scaled ...
Definition: CgmIn.h:646
struct Larson::CCgmIn::CGMI_PD::@11 deviceVPSpecMode
picture device viewport specification mode
Parser – CGM input element parser.
Definition: Parser.h:18
vector< ClippingPath::ProtRegion > m_protRegData
list of protection regions for entire picture
Definition: CgmIn.h:1013
CCgmIn – CGM Input class.
Definition: CgmIn.h:40
long scalingMode
picture scaling mode, abstract or metric
Definition: CgmIn.h:633
CGMI_LEM_BUNDLE lineBundles[MAX_BUNDLES]
line representation bundle
Definition: CgmIn.h:670
long lineWidthSpecMode
picture line width specfication mode: absolute, scaled, fractional, mm; default: scaled ...
Definition: CgmIn.h:642
CFigure – Figure data class.
Definition: Figure.h:17
Definition: CgmIn.h:449
vector< PrimitiveContext > m_primitiveContext
saved primitive contexts
Definition: CgmIn.h:1010
CColor backgroundColor
picture background color
Definition: CgmIn.h:651
extended picture attribute state list, updated from CGM elements as they are read and decoded...
Definition: CgmIn.h:876
long markerSizeSpecMode
picture marker size specfication mode: absolute, scaled, fractional, mm; default: scaled ...
Definition: CgmIn.h:644
text representation bundle
Definition: CgmIn.h:674
decoder data stream structure
Definition: CgmDecode.h:74
Definition: CgmIn.h:428
Definition: CgmIn.h:421
CGMI_LEM_BUNDLE edgeBundles[MAX_BUNDLES]
edge representation bundle
Definition: CgmIn.h:693
Path – graphical path data container class.
Definition: Path.h:17
Aspect Source Flags 0= off 1= on.
Definition: CgmIn.h:701
Definition: CgmDecode.h:128
Definition: CgmIn.h:544
Definition: CgmIn.h:485
CGMI_LEM_BUNDLE markerBundles[MAX_BUNDLES]
marker representation bundle
Definition: CgmIn.h:672
CCgmBaseObj – graphical element container base class.
Definition: CgmObj.h:121
CAppStruct – Application Structure (APS) container class.
Definition: AppStruct.h:23
CCgmTrace – Trace GDP element container class.
Definition: CgmObj.h:1148
picture attribute state list, updated from CGM elements as they are read and decoded.
Definition: CgmIn.h:724
Definition: CgmIn.h:437
Definition: CgmIn.h:443
CGMI_ASFS aspectSourceFlags
Aspect Source Flags 0= off 1= on.
Definition: CgmIn.h:733
edge attributes strcuture used by figure
Definition: Figure.h:25
double scalingFactor
picture scaling factor
Definition: CgmIn.h:636
device viewport mapping offset
Definition: CgmIn.h:662
long colorSelectionMode
picture color selection mode: indexed, direct
Definition: CgmIn.h:639
DPoint vdcExtent[2]
picture vdc extent: [0] = first corner, [1] = second corner
Definition: CgmIn.h:648
DPoint deviceViewport[2]
picture device viewport
Definition: CgmIn.h:654
fill representation bundle
Definition: CgmIn.h:684
CCgmObjects – CGM Picture container.
Definition: CgmObjects.h:472
Retains CGM Metafile Descriptor data while a CGM is being loaded.
Definition: CgmIn.h:593