opennurbs_internal_V5_dimstyle.h
1 /*
2 //
3 // Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved.
4 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
5 // McNeel & Associates.
6 //
7 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
10 //
11 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
12 //
13 ////////////////////////////////////////////////////////////////
14 */
15 
16 #if !defined(OPENNURBS_INTERNAL_V5_DIMSTYLE_INC_)
17 #define OPENNURBS_INTERNAL_V5_DIMSTYLE_INC_
18 
19 #include "opennurbs_internal_defines.h"
20 
21 #if defined(ON_COMPILING_OPENNURBS)
22 
23 // ON_V5x_DimStyle is used to read and write version 5 and earlier archives.
24 // ON_DimStyle is the class for runtime dimension style.
25 class ON_V5x_DimStyle : public ON_ModelComponent
26 {
27  ON_OBJECT_DECLARE(ON_V5x_DimStyle);
28 
29 private:
30  friend class ON_DimStyle;
31 
32 public:
33  enum eArrowType
34  {
35  // eArrowType is used for V5 and earlier dimensions
36  // V6 dimensions (ON_Dimension) use ON_Arrowhead::arrow_type
37  solidtriangle = 0, // 2:1
38  dot = 1,
39  tick = 2,
40  shorttriangle = 3, // 1:1
41  arrow = 4,
42  rectangle = 5,
43  longtriangle = 6, // 4:1
44  longertriangle = 7, // 6:1
45  };
46 
47 public:
49  ~ON_V5x_DimStyle();
50  ON_V5x_DimStyle(const ON_V5x_DimStyle&) = default;
51  ON_V5x_DimStyle& operator=(const ON_V5x_DimStyle&) = default;
52 
53 public:
54  ON_V5x_DimStyle( const class ON_3dmAnnotationSettings& src);
56  ON::LengthUnitSystem model_length_unit_system,
57  const class ON_DimStyle& src
58  );
59 
60 public:
61  bool CompareDimstyle(const ON_V5x_DimStyle& src) const;
62  bool CompareValidFields(const ON_V5x_DimStyle& src) const;
63 
64  //////////////////////////////////////////////////////////////////////
65  //
66  // ON_Object overrides
67 
68  bool IsValid( class ON_TextLog* text_log = nullptr ) const override;
69 
70  // virtual
71  void Dump( ON_TextLog& ) const override; // for debugging
72 
73  // virtual
74  bool Write(
75  ON_BinaryArchive& // serialize definition to binary archive
76  ) const override;
77 
78  // virtual
79  bool Read(
80  ON_BinaryArchive& // restore definition from binary archive
81  ) override;
82 
83  // When a V5 file is being read into v6
84  // Copy the fields that were in DimstyleExtra in v5 into the v6 dimstyle
85  // that now contains the fields that were in DimstyleExtra
86  ///void ConsolidateDimstyleExtra();
87 
88  bool AttachDimstyleExtra();
89 
90 
91  bool Write_v5(
92  ON_BinaryArchive& // serialize definition to binary archive
93  ) const;
94 
95 private:
96  bool Internal_Read_v5(
97  ON_BinaryArchive& // restore definition from binary archive
98  );
99 
100  //bool Write_v6(
101  // ON_BinaryArchive& // serialize definition to binary archive
102  // ) const;
103 
104  bool Internal_Read_v6(
105  ON_BinaryArchive& // restore definition from binary archive
106  );
107 
108 public:
109  void EmergencyDestroy();
110 
111  //////////////////////////////////////////////////////////////////////
112  //
113  // Interface
114 
115  void SetDefaultsNoExtension();
116 
117  double ExtExtension() const;
118  void SetExtExtension( const double);
119 
120  double ExtOffset() const;
121  void SetExtOffset( const double);
122 
123  double ArrowSize() const;
124  void SetArrowSize( const double);
125 
126  double LeaderArrowSize() const;
127  void SetLeaderArrowSize( const double);
128 
129  double CenterMark() const;
130  void SetCenterMark( const double);
131 
132  ON_INTERNAL_OBSOLETE::V5_TextDisplayMode TextAlignment() const;
133  void SetTextAlignment( ON_INTERNAL_OBSOLETE::V5_TextDisplayMode);
134 
135  int ArrowType() const; // For ON_OBSOLETE_V2_Annotation & ON_OBSOLETE_V5_Annotation derived dimensions
136  void SetArrowType( eArrowType); // ON_Dimension derived dimensions use ArrowType1() and ArrowType2()
137 
138  int LeaderArrowType() const;
139  void SetLeaderArrowType( eArrowType);
140 
141  int AngularUnits() const;
142  void SetAngularUnits( int);
143 
144  int LengthFormat() const;
145  void SetLengthFormat( int);
146 
147  int AngleFormat() const;
148  void SetAngleFormat( int);
149 
150  int LengthResolution() const;
151  void SetLengthResolution( int);
152 
153  int AngleResolution() const;
154  void SetAngleResolution( int);
155 
156  const class ON_TextStyle& V5TextStyle() const;
157  void SetV5TextStyle(
158  const class ON_TextStyle& v5_text_style
159  );
160 
161  double TextGap() const;
162  void SetTextGap( double gap);
163 
164  double TextHeight() const;
165  void SetTextHeight( double height);
166 
167  double LengthFactor() const;
168  void SetLengthFactor( double);
169 
170  bool Alternate() const;
171  void SetAlternate( bool);
172 
173  double AlternateLengthFactor() const;
174  void SetAlternateLengthFactor( double);
175 
176  int AlternateLengthFormat() const;
177  void SetAlternateLengthFormat( int);
178 
179  int AlternateLengthResolution() const;
180  void SetAlternateLengthResolution( int);
181 
182  int AlternateAngleFormat() const;
183  void SetAlternateAngleFormat( int);
184 
185  int AlternateAngleResolution() const;
186  void SetAlternateAngleResolution( int);
187 
188  void GetPrefix( ON_wString& ) const;
189  const wchar_t* Prefix() const;
190  void SetPrefix( const wchar_t*);
191  void SetPrefix( wchar_t*);
192 
193  void GetSuffix( ON_wString& ) const;
194  const wchar_t* Suffix() const;
195  void SetSuffix( const wchar_t*);
196  void SetSuffix( wchar_t*);
197 
198  void GetAlternatePrefix( ON_wString& ) const;
199  const wchar_t* AlternatePrefix() const;
200  void SetAlternatePrefix( const wchar_t*);
201  void SetAlternatePrefix( wchar_t*);
202 
203  void GetAlternateSuffix( ON_wString& ) const;
204  const wchar_t* AlternateSuffix() const;
205  void SetAlternateSuffix( const wchar_t*);
206  void SetAlternateSuffix( wchar_t*);
207 
208  bool SuppressExtension1() const;
209  void SetSuppressExtension1( bool);
210 
211  bool SuppressExtension2() const;
212  void SetSuppressExtension2( bool);
213 
214  // Don't change these enum values
215  // They are used in file reading & writing
216  enum class Field : unsigned int
217  {
218  fn_name = 0,
219  fn_index = 1,
220  fn_extextension = 2,
221  fn_extoffset = 3,
222  fn_arrowsize = 4,
223  fn_centermark = 5,
224  fn_textgap = 6,
225  fn_textheight = 7,
226  fn_textalign = 8,
227  fn_arrowtype = 9, // For v5 and previous ON_OBSOLETE_V2_Annotation and ON_OBSOLETE_V5_Annotation dimensions
228  fn_angularunits = 10,
229  fn_lengthformat = 11,
230  fn_angleformat = 12,
231  fn_angleresolution = 13,
232  fn_lengthresolution = 14,
233  fn_fontindex = 15,
234  fn_lengthfactor = 16,
235  fn_bAlternate = 17,
236  fn_alternate_lengthfactor = 18,
237  fn_alternate_lengthformat = 19,
238  fn_alternate_lengthresolution = 20,
239  fn_alternate_angleformat = 21,
240  fn_alternate_angleresolution = 22,
241  fn_prefix = 23,
242  fn_suffix = 24,
243  fn_alternate_prefix = 25,
244  fn_alternate_suffix = 26,
245  fn_dimextension = 27,
246  fn_leaderarrowsize = 28,
247  fn_leaderarrowtype = 29,
248  fn_suppressextension1 = 30,
249  fn_suppressextension2 = 31,
250  fn_last = 32, // not used - left here for sdk
251 
252  // Added for v5 - 5/01/07 LW
253  // version 1.6
254  fn_overall_scale = 33,
255  fn_ext_line_color_source = 34,
256  fn_dim_line_color_source = 35,
257  fn_arrow_color_source = 36,
258  fn_text_color_source = 37,
259  fn_ext_line_color = 38,
260  fn_dim_line_color = 39,
261  fn_arrow_color = 40,
262  fn_text_color = 41,
263  fn_ext_line_plot_color_source = 42,
264  fn_dim_line_plot_color_source = 43,
265  fn_arrow_plot_color_source = 44,
266  fn_text_plot_color_source = 45,
267  fn_ext_line_plot_color = 46,
268  fn_dim_line_plot_color = 47,
269  fn_arrow_plot_color = 48,
270  fn_text_plot_color = 49,
271  fn_ext_line_plot_weight_source = 50,
272  fn_dim_line_plot_weight_source = 51,
273  fn_ext_line_plot_weight_mm = 52,
274  fn_dim_line_plot_weight_mm = 53,
275  fn_tolerance_style = 54,
276  fn_tolerance_resolution = 55,
277  fn_tolerance_upper_value = 56,
278  fn_tolerance_lower_value = 57,
279  fn_tolerance_height_scale = 58,
280  fn_baseline_spacing = 59,
281 
282  // Added for v5 - 12/15/09 LW
283  // version 1.7
284  fn_draw_mask = 60,
285  fn_mask_color_source = 61,
286  fn_mask_color = 62,
287  fn_mask_border = 63,
288 
289  // Added for v5 - 12/17/09 LW
290  // version 1.8
291  fn_dimscale = 64,
292  fn_dimscale_source = 65,
293 
294  // Added for V6 -
295  // version 2.0
296  fn_fixed_extension_len = 66,
297  fn_fixed_extension_on = 67,
298  fn_text_rotation = 68,
299  fn_tolerance_alt_resolution = 69,
300  fn_tolerance_textheight_fraction = 70,
301  fn_suppress_arrow1 = 71,
302  fn_suppress_arrow2 = 72,
303  fn_textmove_leader = 73,
304  fn_arclength_sym = 74,
305  fn_stack_textheight_fraction = 75,
306  fn_stack_format = 76,
307  fn_alt_round = 77,
308  fn_round = 78,
309  fn_alt_zero_suppress = 79,
310  fn_tol_zero_suppress = 80,
311  fn_ang_zero_suppress = 81,
312  fn_zero_suppress = 82,
313  fn_alt_below = 83,
314 
315  fn_dim_arrow_type1 = 84, // For ON_Dimension derived dimensions
316  fn_dim_arrow_type2 = 85,
317  fn_dim_arrow_blockname1 = 86,
318  fn_dim_arrow_blockname2 = 87,
319 
320  FieldCount,
321  fn_unset = 0xFFFE,
322  fn_really_last = 0xFFFF
323  };
324 
325  enum : unsigned int
326  {
327  // must be 1 + the maximum value of an ON_V5x_DimStyle::Field enum value.
328  FieldCount = 88
329  };
330 
331 
332  // Combines a field id and a field value
333  // Dimensions will have an array of DimstyleField's to record
334  // dimension style overrides for individual dimensions
335  class DimstyleField
336  {
337  public:
338  DimstyleField()
339  : m_next(nullptr)
340  , m_field_id(ON_V5x_DimStyle::Field::fn_unset)
341  {
342  m_val.s_val = nullptr;
343  }
344  ~DimstyleField()
345  {
346  if (nullptr != m_next)
347  {
348  delete m_next;
349  m_next = nullptr;
350  }
351  if (nullptr != m_val.s_val)
352  {
353  delete m_val.s_val;
354  m_val.s_val = nullptr;
355  }
356  }
357 
358  DimstyleField* m_next;
359  ON_V5x_DimStyle::Field m_field_id;
360  union
361  {
362  bool b_val;
363  int i_val;
364  unsigned char uc_val;
365  double d_val;
366  unsigned int c_val;
367  const ON_wString* s_val;
368  } m_val;
369  };
370 
371  // added version 1.3
372  double DimExtension() const;
373  void SetDimExtension( const double);
374 
375  // This section Added for v5 - 4-24-07 LW
376  // version 1.6
377 
378  // Test if a specific field has been set in this dimstyle
379  // and not inherited from its parent.
380  bool IsFieldOverride(ON_V5x_DimStyle::Field field_id) const;
381  // Set a field to be overridden or not
382  // Fields that aren't overrides inherit from their parent dimstyle
383  void SetFieldOverride(ON_V5x_DimStyle::Field field_id, bool bOverride);
384 
385 
386  /*
387  Clear all field overrides
388  */
389  void ClearAllFieldOverrides();
390 
391  // Test if the dimstyle has any field override flags set
392  bool HasOverrides() const;
393 
394  // Change the fields in this dimstyle to match the fields of the
395  // source dimstyle for all of the fields that are marked overridden in the source
396  // and to match the parent for all of the fields not marked overriden.
397  // Returns true if any overrides were set.
398  bool OverrideFields( const ON_V5x_DimStyle& source, const ON_V5x_DimStyle& parent);
399 
400  //
401  // Change the fields in this dimstyle to match the fields of the
402  // parent dimstyle for all of the fields that are not marked overridden in the
403  // target dimstyle.
404  // This is the complement of OverrideFields()
405  bool InheritFields( const ON_V5x_DimStyle& parent);
406 
407  // Test if this dimstyle is the child of any other dimstyle
408  bool IsChildDimstyle() const;
409 
410  // Test if this dimstyle is the child of a given dimstyle
411  // A dimstyle may have several child dimstyles, but only one parent
412  bool IsChildOf(const ON_UUID& parent_uuid) const;
413 
414  // use ON_ModelComponent parent id - // ON_UUID ParentId() const;
415 
416  // Set the parent of this dimstyle
417  // use ON_ModelComponent parent id - //void SetParentId(ON_UUID parent_uuid);
418 
419  // Tolerances
420  // Tolerance style
421  // 0: None
422  // 1: Symmetrical
423  // 2: Deviation
424  // 3: Limits
425  // 4: Basic
426  enum eToleranceStyle
427  {
428  tsMin = 0,
429  tsNone = 0,
430  tsSymmetrical = 1,
431  tsDeviation = 2,
432  tsLimits = 3,
433  tsBasic = 4,
434  tsMax = 4
435  };
436  int ToleranceStyle() const;
437  int ToleranceResolution() const;
438  double ToleranceUpperValue() const;
439  double ToleranceLowerValue() const;
440  double ToleranceHeightScale() const;
441 
442  double BaselineSpacing() const;
443 
444  void SetToleranceStyle( int style);
445  void SetToleranceResolution( int resolution);
446  void SetToleranceUpperValue( double upper_value);
447  void SetToleranceLowerValue( double lower_value);
448  void SetToleranceHeightScale( double scale);
449 
450  void SetBaselineSpacing( double spacing = false);
451 
452  // Determines whether or not to draw a Text Mask
453  bool DrawTextMask() const;
454  void SetDrawTextMask(bool bDraw);
455 
456  // Determines where to get the color to draw a Text Mask
457  // 0: Use background color of the viewport. Initially, gradient backgrounds will not be supported
458  // 1: Use the ON_Color returned by MaskColor()
459  int MaskColorSource() const;
460  void SetMaskColorSource(int source);
461 
462  ON_Color MaskColor() const; // Only works right if MaskColorSource returns 1.
463  // Does not return viewport background color
464  void SetMaskColor(ON_Color color);
465 
466  // Per DimStyle DimScale
467  void SetDimScaleSource(int source);
468  int DimScaleSource() const; // 0: Global DimScale, 1: DimStyle DimScale
469  void SetDimScale(double scale);
470  double DimScale() const;
471 
472  // Offset for the border around text to the rectangle used to draw the mask
473  // This number * CRhinoAnnotation::TextHeight() for the text is the offset
474  // on each side of the tight rectangle around the text characters to the mask rectangle.
475  double MaskOffsetFactor() const;
476 
477  void Scale( double scale);
478 
479  // UUID of the dimstyle this was originally copied from
480  // so Restore Defaults has some place to look
481  void SetSourceDimstyle(ON_UUID source_uuid);
482  ON_UUID SourceDimstyle() const;
483 
484  // ver 2.0 V6
485 
486  void SetExtensionLineColorSource(const ON::object_color_source src);
487  ON::object_color_source ExtensionLineColorSource() const;
488  void SetDimensionLineColorSource(const ON::object_color_source src);
489  ON::object_color_source DimensionLineColorSource() const;
490  void SetArrowColorSource(const ON::object_color_source src);
491  ON::object_color_source ArrowColorSource() const;
492  void SetExtensionLineColor(ON_Color c);
493  ON_Color ExtensionLineColor() const;
494  void SetDimensionLineColor(ON_Color c);
495  ON_Color DimensionLineColor() const;
496  void SetArrowColor(ON_Color c);
497  ON_Color ArrowColor() const;
498  void SetTextColor(ON_Color c);
499  ON_Color TextColor() const;
500 
501  void SetExtensionLinePlotColorSource(const ON::plot_color_source src);
502  ON::plot_color_source ExtensionLinePlotColorSource() const;
503  void SetDimensionLinePlotColorSource(const ON::plot_color_source src);
504  ON::plot_color_source DimensionLinePlotColorSource() const;
505  void SetArrowPlotColorSource(const ON::plot_color_source src);
506  ON::plot_color_source ArrowPlotColorSource() const;
507  void SetExtensionLinePlotColor(ON_Color c);
508  ON_Color ExtensionLinePlotColor() const;
509  void SetDimensionLinePlotColor(ON_Color c);
510  ON_Color DimensionLinePlotColor() const;
511  void SetArrowPlotColor(ON_Color c);
512  ON_Color ArrowPlotColor() const;
513  void SetTextPlotColor(ON_Color c);
514  ON_Color TextPlotColor() const;
515 
516  void SetExtensionLinePlotWeightSource(const ON::plot_weight_source src);
517  ON::plot_weight_source ExtensionLinePlotWeightSource() const;
518  void SetDimensionLinePlotWeightSource(const ON::plot_weight_source src);
519  ON::plot_weight_source DimensionLinePlotWeightSource() const;
520  void SetExtensionLinePlotWeight(double w);
521  double ExtensionLinePlotWeight() const;
522  void SetDimensionLinePlotWeight(double w);
523  double DimensionLinePlotWeight() const;
524 
525  void SetFixedExtensionLen(double l);
526  double FixedExtensionLen() const;
527  void SetFixedExtensionLenOn(bool on);
528  bool FixedExtensionLenOn() const;
529  void SetTextRotation(double r);
530  double TextRotation() const;
531  void SetAlternateToleranceResolution(int r);
532  int AlternateToleranceResolution() const;
533  //void SetAlternateTolHeightFraction(double f);
534  //double AltTolHeightFraction() const;
535  void SetSuppressArrow1(bool s);
536  bool SuppressArrow1() const;
537  void SetSuppressArrow2(bool s);
538  bool SuppressArrow2() const;
539  void SetTextMoveLeader(int m);
540  int TextMoveLeader() const;
541  void SetArcLengthSymbol(int m);
542  int ArcLengthSymbol() const;
543  void SetStackFractionFormat(int f);
544  int StackFractionFormat() const;
545  void SetStackHeightFraction(double f);
546  double StackHeightFraction() const;
547  void SetRoundOff(double r);
548  double RoundOff() const;
549  void SetAlternateRoundOff(double r);
550  double AlternateRoundOff() const;
551  void SetZeroSuppress(int s);
552  int ZeroSuppress() const;
553  void SetAlternateZeroSuppress(int s);
554  int AlternateZeroSuppress() const;
555  void SetToleranceZeroSuppress(int s);
556  int ToleranceZeroSuppress() const;
557  void SetAngleZeroSuppress(int s);
558  int AngleZeroSuppress() const;
559  void SetAlternateBelow(bool below);
560  bool AlternateBelow() const;
561  void SetArrowType1(ON_Arrowhead::arrow_type); // ON_Dimension derived dimensions
562  ON_Arrowhead::arrow_type ArrowType1() const;
563  void SetArrowBlockId1(ON_UUID id);
564  ON_UUID ArrowBlockId1() const;
565  void SetArrowType2(ON_Arrowhead::arrow_type);
566  ON_Arrowhead::arrow_type ArrowType2() const;
567  void SetArrowBlockId2(ON_UUID id);
568  ON_UUID ArrowBlockId2() const;
569  const ON_Arrowhead& Arrowhead1() const;
570  const ON_Arrowhead& Arrowhead2() const;
571 
572 
573 
574  // Defaults for values stored in Userdata extension - needed to read and write pre-v6 files
575  static int DefaultToleranceStyle();
576  static int DefaultToleranceResolution();
577  static double DefaultToleranceUpperValue();
578  static double DefaultToleranceLowerValue();
579  static double DefaultToleranceHeightScale();
580  static double DefaultBaselineSpacing();
581  static bool DefaultDrawTextMask(); // false
582  static int DefaultMaskColorSource(); // 0;
583  static ON_Color DefaultMaskColor(); // .SetRGB(255,255,255);
584  static double DefaultDimScale(); // 1.0;
585  static int DefaultDimScaleSource(); // 0;
586 
587  bool CompareFields(const ON_V5x_DimStyle& other) const;
588 
589 public:
590  double m_extextension = 0.5; // extension line extension
591  double m_extoffset = 0.5; // extension line offset
592  double m_arrowsize = 1.0; // length of an arrow - may mean different things to different arrows
593  double m_centermark = 0.5; // size of the + at circle centers
594  double m_textgap = 0.25; // gap around the text for clipping dim line
595  double m_textheight = 1.0; // model unit height of dimension text before applying dimscale
596  ON_INTERNAL_OBSOLETE::V5_TextDisplayMode m_dimstyle_textalign = ON_INTERNAL_OBSOLETE::V5_TextDisplayMode::kAboveLine; // text alignment relative to the dimension line
597  int m_arrowtype = 0; // 0: filled narrow triangular arrow - For ON_OBSOLETE_V2_Annotation & ON_OBSOLETE_V5_Annotation derived dimensnions
598  // m_arrowtype = ((ON_Arrowhead::arrow_type enum value as int) - 2)
599  int m_angularunits = 0; // 0: degrees, 1: radians
600  int m_lengthformat = 0; // 0: decimal, 1: fractional, 2: feet & inches
601  int m_angleformat = 0; // 0: decimal degrees, 1:DMS, ...
602  int m_angleresolution = 2; // for decimal degrees, digits past decimal
603  int m_lengthresolution = 2; // depends on m_lengthformat
604  // for decimal, digits past the decimal point
605 private:
606  ON_TextStyle m_v5_text_style = ON_TextStyle::Default;
607 
608 public:
609  // added fields version 1.2, Jan 13, 05
610  double m_lengthfactor = 1.0; // (dimlfac) model units multiplier for length display
611 
612  bool m_bAlternate = false; // (dimalt) display alternate dimension string (or not)
613  // using m_alternate_xxx values
614 
615  double m_alternate_lengthfactor = 1.0; // (dimaltf) model units multiplier for alternate length display
616  int m_alternate_lengthformat = 0; // 0: decimal, 1: feet, 2: feet & inches
617  int m_alternate_lengthresolution = 2; // depends on m_lengthformat
618  // for decimal, digits past the decimal point
619 
620  int m_alternate_angleformat = 0; // 0: decimal degrees, ...
621  int m_alternate_angleresolution = 2; // for decimal degrees, digits past decimal
622 
623  ON_wString m_prefix; // string preceding dimension value string
624  ON_wString m_suffix; // string following dimension value string
625  ON_wString m_alternate_prefix; // string preceding alternate value string
626  ON_wString m_alternate_suffix; // string following alternate value string
627 
628 private:
629  ///unsigned int m_valid = 0; // Obsolete deprecated field to be removed - Do not use
630 public:
631 
632  // field added version 1.4, Dec 28, 05
633  double m_dimextension = 0.0; // (dimdle) dimension line extension past the "tip" location
634 
635  // fields added version 1.5 Mar 23 06
636  double m_leaderarrowsize = 1.0; // Like dimension arrow size but applies to leaders
637  int m_leaderarrowtype = 0; // Like dimension arrow type but applies to leaders
638  bool m_bSuppressExtension1 = false; // flag to not draw extension lines
639  bool m_bSuppressExtension2 = false; // flag to not draw extension lines
640 
641 private:
642  friend class ON_DimStyleExtra;
643  // 8 Apr, 2014 - The next few fields were transferred from ON_DimStyleExtra for V6
644  /// Use ON_ModelComponent.ParentId() /// ON_UUID m_parent_dimstyle = ON_nil_uuid; // ON_nil_uuid if there is no parent dimstyle
645  unsigned int m_field_override_count = 0; // number of
646  bool m_field_override[ON_V5x_DimStyle::FieldCount];
647 
648 public:
649  int m_tolerance_style = 0;
650  int m_tolerance_resolution = 4;
651  double m_tolerance_upper_value = 0.0; // or both upper and lower in symmetrical style
652  double m_tolerance_lower_value = 0.0;
653  double m_tolerance_height_scale = 1.0; // relative to the main dimension text
654 
655  double m_baseline_spacing = 1.0;
656 
657  // Text mask - added Dec 12 2009
658  bool m_bDrawMask = false;
659  int m_mask_color_source = 0;
660  ON_Color m_mask_color = ON_Color::White;
661 
662  // Per dimstyle DimScale added Dec 16, 2009
663  double m_dimscale = 1.0;
664  int m_dimscale_source = 0;
665 
666  // 19 Oct 2010 - Added uuid of source dimstyle to restore defaults
667  ON_UUID m_source_dimstyle = ON_nil_uuid;
668  // End of fields that were in ON_DimStyleExtra
669 
670  // Fields added for V6, ver 2.0
671 
672  unsigned char m_ext_line_color_source = 0;
673  unsigned char m_dim_line_color_source = 0;
674  unsigned char m_arrow_color_source = 0;
675  unsigned char m_text_color_source = 0;
676  ON_Color m_ext_line_color = ON_Color::Black;
677  ON_Color m_dim_line_color = ON_Color::Black;
678  ON_Color m_arrow_color = ON_Color::Black;
679  ON_Color m_text_color = ON_Color::Black;
680  unsigned char m_ext_line_plot_color_source = 0;
681  unsigned char m_dim_line_plot_color_source = 0;
682  unsigned char m_arrow_plot_color_source = 0;
683  unsigned char m_text_plot_color_source = 0;
684  ON_Color m_ext_line_plot_color = ON_Color::Black;
685  ON_Color m_dim_line_plot_color = ON_Color::Black;
686  ON_Color m_arrow_plot_color = ON_Color::Black;
687  ON_Color m_text_plot_color = ON_Color::Black;
688  unsigned char m_ext_line_plot_weight_source = 0;
689  unsigned char m_dim_line_plot_weight_source = 0;
690  double m_ext_line_plot_weight_mm = 0.0;
691  double m_dim_line_plot_weight_mm = 0.0;
692 
693  double m_fixed_extension_len = 1.0; // Fixed extension line length if m_fixed_extension_len_on is true
694  bool m_fixed_extension_len_on = false; // true: use fixed_extension_len, false: don't use m_fixed_extension_len
695  double m_text_rotation = 0.0; // Dimension text rotation around text point (radians)
696  int m_alt_tol_resolution = 4; // for decimal, digits past the decimal point, fractions: 1/2^n
697  double m_tol_textheight_fraction = 1.0; // fraction of main text height
698  bool m_suppress_arrow1 = false; // false: dont suppress, true: suppress
699  bool m_suppress_arrow2 = false; // false: dont suppress, true: suppress
700  int m_textmove_leader = 0; // 0: move text anywhere, 1: add leader when moving text
701  int m_arclength_sym = 0; // 0: symbol before dim text, 1: symbol above dim text, no symbol
702  double m_stack_textheight_fraction = 1.0; // fraction of main text height
703  int m_stack_format = 0; // 0: no stacking, 1: horizontal, 2: diagonal
704  double m_alt_round = 0.0; // rounds to nearest specified value
705  double m_round = 0.0;
706  int m_alt_zero_suppress = 0; // 0: no zero suppressing
707  int m_tol_zero_suppress = 0; // 1: suppress zero feet
708  int m_zero_suppress = 0; // 2: suppress zero inches
709  int m_ang_zero_suppress = 0; // 3: suppress both zero feet and 0 inches
710  // 4: suppress leading zeros
711  // 8: suppress trailing zeros
712  // 12: suppress both leading and trailing zeros
713  bool m_alt_below = false; // true: display alternate text below main text
714  // true: display alternate text after main text
715  //ON_Arrowhead::arrow_type m_arrow_type_1; // Arrow types for ON_Dimension derived dimensions
716  //ON_Arrowhead::arrow_type m_arrow_type_2;
717  //ON_wString m_dim_arrow_block1;
718  //ON_wString m_dim_arrow_block2;
719 
720  ON_Arrowhead m_arrow_1;
721  ON_Arrowhead m_arrow_2;
722 };
723 
724 void ON_Internal_FixBogusDimStyleLengthFactor(
725  const class ON_BinaryArchive& file,
726  double& dimstyle_length_factor
727 );
728 
729 #endif
730 
731 #endif
void SetAngleResolution(int)
void SetLeaderArrowType(ON_Arrowhead::arrow_type)
ON_UUID is a 16 byte universally unique identifier.
Definition: opennurbs_uuid.h:32
arrow_type
Defines enumerated values for arrowhead shapes.
Definition: opennurbs_dimensionstyle.h:37
The ON_ModelComponent class is a base class for all components in a model and manages the index...
Definition: opennurbs_model_component.h:24
Definition: opennurbs_dimensionstyle.h:21
void Dump(ON_TextLog &) const override
Creates a text dump of the object.
ON_Arrowhead::arrow_type LeaderArrowType() const
void SetCenterMark(const double)
bool IsValid(class ON_TextLog *text_log=nullptr) const override
Tests an object to see if its data members are correctly initialized.
Definition: opennurbs_string.h:2020
Definition: opennurbs_dimensionstyle.h:218
void SetExtExtension(const double)
Definition: opennurbs_color.h:24
void SetArrowSize(const double)
double LeaderArrowSize() const
Arrow size.
void SetLeaderArrowSize(const double)
Definition: opennurbs_3dm_settings.h:110
double ExtExtension() const
Extension line extension.
int LengthResolution() const
Display resolution for distance measurements.
int AngleResolution() const
Display resolution for angle measurements.
double ArrowSize() const
Arrow size.
static const ON_TextStyle Default
Definition: opennurbs_text_style.h:25
void EmergencyDestroy()
Sets m_user_data_list = 0.
Definition: opennurbs_text_style.h:19
static const ON_Color White
Definition: opennurbs_color.h:34
friend class ON_V5x_DimStyle
Definition: opennurbs_dimensionstyle.h:222
void SetExtOffset(const double)
void SetAngleFormat(angle_format format)
Definition: opennurbs_textlog.h:20
Definition: opennurbs_archive.h:1783
double ExtOffset() const
Extension line offset.
ON_ModelComponent & operator=(const ON_ModelComponent &source)
void SetLengthResolution(int)
virtual bool Read(ON_BinaryArchive &binary_archive)
Low level archive writing tool used by ON_BinaryArchive::ReadObject().
virtual bool Write(ON_BinaryArchive &binary_archive) const
Low level archive writing tool used by ON_BinaryArchive::WriteObject().
double CenterMark() const
Centermark size.
angle_format AngleFormat() const
static const ON_Color Black
Definition: opennurbs_color.h:33
bool CompareDimstyle(const ON_DimStyle &src) const