opennurbs_dimensionstyle.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 #if !defined(OPENNURBS_DIMENSIONSTYLE_INC_)
18 #define OPENNURBS_DIMENSIONSTYLE_INC_
19 
20 
21 class ON_CLASS ON_Arrowhead
22 {
23 public:
24  ON_Arrowhead() = default;
25  ~ON_Arrowhead() = default;
26  ON_Arrowhead(const ON_Arrowhead&) = default;
27  ON_Arrowhead& operator=(const ON_Arrowhead&) = default;
28 
29  bool operator==(const ON_Arrowhead& other) const;
30  bool operator!=(const ON_Arrowhead& other) const;
31 
32 
33 #pragma region RH_C_SHARED_ENUM [ON_Arrowhead::arrow_type] [Rhino.DocObjects.DimensionStyle.ArrowType] [nested:int]
34  /// <summary>
35  /// Defines enumerated values for arrowhead shapes.
36  /// </summary>
37  enum class arrow_type : unsigned int
38  {
39  /// <summary> </summary>
40  None = 0,
41  /// <summary> </summary>
42  UserBlock = 1,
43  /// <summary> </summary>
44  SolidTriangle = 2, // 2:1
45  /// <summary> </summary>
46  Dot = 3,
47  /// <summary> </summary>
48  Tick = 4,
49  /// <summary> </summary>
50  ShortTriangle = 5, // 1:1
51  /// <summary> </summary>
52  OpenArrow = 6,
53  /// <summary> </summary>
54  Rectangle = 7,
55  /// <summary> </summary>
56  LongTriangle = 8, // 4:1
57  /// <summary> </summary>
58  LongerTriangle = 9, // 6:1
59  };
60 #pragma endregion
61 
62  static ON_Arrowhead::arrow_type ArrowTypeFromUnsigned(
63  unsigned int type_as_unsigned
64  );
65 
66  arrow_type ArrowheadType() const;
67  void SetArrowheadType(arrow_type type);
68  ON_UUID ArrowBlockId() const;
69  void SetArrowBlockId(ON_UUID id);
70 
71  static ON__UINT32 GetPoints(
72  arrow_type type,
73  const double*& points);
74 
75  static ON__UINT32 GetPoints(
76  arrow_type type,
77  ON_2dPointArray& points);
78 
79  static bool GetArrowheadBoundingBox(
81  ON_UUID arrow_block_id,
82  ON_Xform xform,
83  ON_BoundingBox& bbox,
84  bool grow);
85 
86  static
87  ON_Arrowhead::arrow_type DefaultArrowType();
88 
89 private:
90  arrow_type m_arrowhead_type = ON_Arrowhead::arrow_type::SolidTriangle;
91  ON_UUID m_arrow_block_id = ON_nil_uuid;
92 
93 };
94 
95 class ON_CLASS ON_TextMask
96 {
97 public:
98 
99 #pragma region RH_C_SHARED_ENUM [ON_TextMask::MaskType] [Rhino.DocObjects.DimensionStyle.MaskType] [nested:byte]
100  /// <summary>
101  /// Text mask drawn with background color or explicit color
102  /// </summary>
103  enum class MaskType : unsigned char
104  {
105  /// <summary>
106  /// Text mask drawn with background color
107  /// </summary>
108  BackgroundColor = 0,
109  /// <summary>
110  /// Text mask drawn with explicit color
111  /// </summary>
112  MaskColor = 1,
113  };
114 #pragma endregion
115 
116  static ON_TextMask::MaskType MaskTypeFromUnsigned(
117  unsigned int mask_type_as_unsigned
118  );
119 
120 public:
121 
122  /*
123  The default constructor content is idenical to ON_TextMask::None.
124  */
125  ON_TextMask() = default;
126  ~ON_TextMask() = default;
127  ON_TextMask(const ON_TextMask& src) = default;
128  ON_TextMask& operator=(const ON_TextMask& src) = default;
129 
130 public:
132  /*
133  ON_TextMask::None has no effect on text appearance.
134  */
135  static const ON_TextMask None;
136 
137  /*
138  Description:
139  ON_TextMask::Compare() compares content in a repeatable
140  and well ordered way.
141  Returns:
142  0: lhs and rhs have identical content.
143  <0: lhs content is less than rhs content
144  >0: lhs content is greater than rhs content
145  */
146  static int Compare(
147  const ON_TextMask& lhs,
148  const ON_TextMask& rhs
149  );
150 
151  // Specifies whether or not to draw a Text Mask
152  bool DrawTextMask() const;
153  void SetDrawTextMask(bool bDraw);
154 
155  // Determines where to get the color to draw a Text Mask
156  // Can be background color or a specific color
157  ON_TextMask::MaskType MaskFillType() const;
158  void SetMaskFillType(ON_TextMask::MaskType source);
159 
160  /*
161  Returns:
162  Mask color.
163  Remarks:
164  The mask color is applied only when MaskFillType() = ON_TextMask::MaskType::MaskColor
165  */
166  ON_Color MaskColor() const;
167 
168  void SetMaskColor(
169  ON_Color color
170  );
171 
172  /*
173  Returns:
174  Width of border area around text to be masked. The default value is 0.0.
175  */
176  double MaskBorder() const;
177 
178  void SetMaskBorder(double offset);
179 
180  bool Write(
181  ON_BinaryArchive& archive
182  ) const;
183 
184  bool Read(
185  ON_BinaryArchive& archive
186  );
187 
188  /*
189  Returns:
190  A SHA1 of the values defining the text mask.
191  Two text masks have the same
192  content if and only if they have identical content hash values.
193  */
194  const ON_SHA1_Hash& ContentHash() const;
195 
196 private:
197  bool m_bDrawMask = false;
199 
200  unsigned char m_reserved1 = 0;
201  unsigned char m_reserved2 = 0;
202 
203  ON_Color m_mask_color = ON_Color::White;
204  double m_mask_border = 0.0;
205 
206  // At some point, the reserved fields may have the name changed and be
207  // used to store additional informtion of how to draw the mask,
208  // (feathered edges, rounded corners, etc.).
209  unsigned int m_reserved3 = 0;
210  mutable ON_SHA1_Hash m_content_hash = ON_SHA1_Hash::ZeroDigest;
211 };
212 
213 bool operator==(
214  const class ON_TextMask& lhs,
215  const class ON_TextMask& rhs
216  );
217 
218 bool operator!=(
219  const class ON_TextMask& lhs,
220  const class ON_TextMask& rhs
221  );
223 
224 class ON_CLASS ON_DimStyle : public ON_ModelComponent
225 {
226  ON_OBJECT_DECLARE(ON_DimStyle);
227 private:
228  friend class ON_V5x_DimStyle;
230 public:
231  // Predefined default dimension styles always available
232  static const ON_DimStyle Unset; // index = ON_UNSET_INT_INDEX, id = nil.
233  static const ON_DimStyle Default; // index = -1, unique and persistent id.
234  static const ON_DimStyle DefaultInchDecimal; // index = -2, unique and persistent id.
235  static const ON_DimStyle DefaultInchFractional; // index = -3, unique and persistent id.
236  static const ON_DimStyle DefaultFootInchArchitecture; // index = -4, unique and persistent id.
237  static const ON_DimStyle DefaultMillimeterSmall; // index = -5, unique and persistent id.
238  static const ON_DimStyle DefaultMillimeterLarge; // index = -6, unique and persistent id.
239  static const ON_DimStyle DefaultMillimeterArchitecture; // index = -7, unique and persistent id.
240 
241 public:
242  /*
243  Parameters:
244  dimstyle - [in]
245  Returns:
246  If dimstyle not nullptr, then dimstyle is returned.
247  Otherwise a non-null pointer to a persistent dimstyle is returned.
248  A null pointer is never returned.
249  Remarks:
250  This function is used when a dimension style is required.
251  */
252  static const class ON_DimStyle& DimStyleOrDefault(
253  const class ON_DimStyle* dimstyle
254  );
255 
256  /*
257  Parameters:
258  id - [in]
259  Returns:
260  If the id is not nil and identifies one of the above system dimstyles, that
261  dimstyle is returned. Otherwise, ON_DimStyle::Unset is returned.
262  */
263  static const ON_DimStyle& SystemDimstyleFromId(
264  ON_UUID id
265  );
266 
267  /*
268  Parameters:
269  index - [in]
270  Returns:
271  If the id is not nil and identifies one of the above system dimstyles, that
272  dimstyle is returned. Otherwise, ON_DimStyle::Unset is returned.
273  */
274  static const ON_DimStyle& SystemDimstyleFromIndex(
275  int index
276  );
277 
278  /*
279  Parameters:
280  name_hash - [in]
281  Returns:
282  If the id is not nil and identifies one of the above system dimstyles, that
283  dimstyle is returned. Otherwise, ON_DimStyle::Unset is returned.
284  */
285  static const ON_DimStyle& SystemDimstyleFromName(
286  const ON_NameHash& name_hash
287  );
288 
289  /*
290  Parameters:
291  name_hash - [in]
292  Returns:
293  If the id is not nil and identifies one of the above system dimstyles, that
294  dimstyle is returned. Otherwise, ON_DimStyle::Unset is returned.
295  */
297  const ON_SHA1_Hash& content_hash
298  );
299 
300 private:
301  /*
302  Parameters:
303  system_dimstyle_list - [out]
304  Returns:
305  Number of system dimstyles.
306  Remarks:
307  ON_DimStyle::Unset is not added system_dimstyle_list[].
308  */
309  static unsigned int Internal_GetSystemDimstyleList(
310  ON_SimpleArray<const ON_DimStyle*>& system_dimstyle_list
311  );
312 
313 public:
314 
315  /*
316  Parameters:
317  model_component_reference - [in]
318  none_return_value - [in]
319  value to return if ON_DimStyle::Cast(model_component_ref.ModelComponent())
320  is nullptr
321  Returns:
322  If ON_DimStyle::Cast(model_component_ref.ModelComponent()) is not nullptr,
323  that pointer is returned. Otherwise, none_return_value is returned.
324  */
325  static const ON_DimStyle* FromModelComponentRef(
326  const class ON_ModelComponentReference& model_component_reference,
327  const ON_DimStyle* none_return_value
328  );
329 
330  /*
331  Description:
332  Create a clean dimension style that has the specified font.
333  With the exception of the name, the resulting dimension style
334  will have an unset ON_ModelComponent properties (id, index, ...).
335  Parameters:
336  font_characteristics - [in]
337  If nullptr, then &ON_Font::Default is used.
338  model_space_text_scale - [in]
339  If model_space_text_scale is > 0.0, then it is used to set
340  the DimScale() value.
341  dimstyle_settings - [in]
342  Setting for non-font dimstyle properties.
343  If nullptr, then &ON_DimStyle::Default is used.
344  manifest - [in]
345  If manifest is not nullptr, then it is used to generate
346  a unique name.
347  destination - [in]
348  If destination is not nullptr, the result is stored here.
349  Otherwise operator new is used to construct an ON_DimStyle on the heap.
350  */
351  static ON_DimStyle* CreateFromFont(
352  const ON_Font* font_characteristics,
353  double model_space_text_scale,
354  const ON_DimStyle* dimstyle_settings,
355  const class ON_ComponentManifest* manifest,
356  ON_DimStyle* destination
357  );
358 
359 public:
360  // Default constructor result is identical to ON_DimStyle::Unset;
361  ON_DimStyle();
362 
363  ~ON_DimStyle() = default;
364  ON_DimStyle(const ON_DimStyle& src) = default;
365  ON_DimStyle& operator=(const ON_DimStyle&) = default;
366 
367 public:
368  // Used when reading V5 and earlier archives
369  ON_DimStyle(
370  ON::LengthUnitSystem model_length_unit_system,
371  const class ON_V5x_DimStyle& src
372  );
373 
374 public:
376 
377  /*
378  Returns:
379  True:
380  "this" and src have identical names, dimension style appearance attributes,
381  and identical atttributes inherited from the same parent dimension style.
382  ON_ModelComponent settings other than Name() and ParentId() are
383  not compared.
384  Remaraks:
385  A better name for this function would be EqualForAllPracticalPurposes().
386  */
387  bool CompareDimstyle(const ON_DimStyle& src) const;
388 
389  /*
390  Returns:
391  True if this and src have identical dimension style appearance attributes
392  and the same parent dimension style id.
393  CompareFields() ignores Name, Index, Id() values.
394  CompareFields() ignores differences in IsOverride(field_id) values.
395  Remaraks:
396  A better name for this function would be EqualAppearanceSettings().
397  */
398  bool CompareFields(const ON_DimStyle& src) const;
399 
400 private:
401  /*
402  Returns:
403  True:
404  If a.IsFieldOverride(field_id) == b.IsFieldOverride(field_id)
405  for all ON_DimStyle::field enum values.
406  */
407  static bool Internal_EqualOverrideParentFields(
408  const ON_DimStyle& a,
409  const ON_DimStyle& b
410  );
411 public:
412 
413  //////////////////////////////////////////////////////////////////////
414  //
415  // ON_Object overrides
416 
417  // virtual
418  bool IsValid( class ON_TextLog* text_log = nullptr ) const override;
419 
420  // virtual
421  void Dump(ON_TextLog&) const override; // for debugging
422 
423  // virtual
424  bool Write(
425  ON_BinaryArchive& // serialize definition to binary archive
426  ) const override;
427 
428  // virtual
429  bool Read(
430  ON_BinaryArchive& // restore definition from binary archive
431  ) override;
432 
433  //////////////////////////////////////////////////////////////////////
434  // Interface
435 
436  void EmergencyDestroy();
437 
438  //////////////////////////////////////////////////////////////////////
439  // Interface
440 
441 #pragma region RH_C_SHARED_ENUM [ON_DimStyle::LengthDisplay] [Rhino.DocObjects.DimensionStyle.LengthDisplay] [nested:int]
442  /// <summary>
443  /// Dimension display length unit system and style
444  /// </summary>
445  enum class LengthDisplay : unsigned int
446  {
447  /// <summary>
448  /// Decimal current model units
449  /// </summary>
450  ModelUnits = 0,
451 
452  /// <summary>
453  /// Decimal Millimeters
454  /// </summary>
455  Millmeters = 3,
456 
457  /// <summary>
458  /// Decimal Centimeters
459  /// </summary>
460  Centimeters = 4,
461 
462  /// <summary>
463  /// Decimal Meters
464  /// </summary>
465  Meters = 5,
466 
467  /// <summary>
468  /// Decimal Kilometers
469  /// </summary>
470  Kilometers = 6,
471 
472  /// <summary>
473  /// Decimal Inches
474  /// </summary>
475  InchesDecimal = 7,
476 
477  /// <summary>
478  /// Fractional Inches ( 1.75 inches displays as 1-3/4 )
479  /// </summary>
480  InchesFractional = 1,
481 
482  /// <summary>
483  /// Decimal Feet
484  /// </summary>
485  FeetDecimal = 8,
486 
487  /// <summary>
488  /// Feet and Inches ( 14.75 inches displays as 1&apos;-2-3/4&quot; )
489  /// </summary>
490  FeetAndInches = 2,
491 
492  /// <summary>
493  /// Decimal Miles
494  /// </summary>
495  Miles = 9
496  };
497 
498 #pragma endregion
499 
500  static ON_DimStyle::LengthDisplay LengthDisplayFromUnsigned(
501  unsigned int length_display_as_unsigned
502  );
504  /*
505  Returns:
506  true if length_display selects a decimal format.
507  false if length_display is ON_DimStyle::LengthDisplay::FeetAndInches
508  or ON_DimStyle::LengthDisplay::InchesFractional.
509  */
510  static bool LengthDisplayIsDecimal(
511  ON_DimStyle::LengthDisplay dimension_length_display
512  );
513 
514  static ON::LengthUnitSystem LengthUnitSystemFromLengthDisplay(
515  ON_DimStyle::LengthDisplay dimension_length_display
516  );
517 
518 
519 #pragma region RH_C_SHARED_ENUM [ON_DimStyle::tolerance_format] [Rhino.DocObjects.DimensionStyle.ToleranceDisplayFormat] [nested:byte]
520  /// <summary>
521  /// Style of tolerance display for dimensions
522  /// </summary>
523  enum class tolerance_format : unsigned char
524  {
525  /// <summary>
526  /// No tolerance display
527  /// </summary>
528  None = 0,
529  /// <summary>
530  /// Symmetrical +/- tolerance
531  /// </summary>
532  Symmetrical = 1,
533  /// <summary>
534  /// Distance +tol, -tol
535  /// </summary>
536  Deviation = 2,
537  /// <summary>
538  /// Distance upper and lower limits
539  /// </summary>
540  Limits = 3,
541  };
542 #pragma endregion
543 
544  static ON_DimStyle::tolerance_format ToleranceFormatFromUnsigned(
545  unsigned int format_as_unsigned
546  );
547 
548 
549 #pragma region RH_C_SHARED_ENUM [ON_DimStyle::ContentAngleStyle] [Rhino.DocObjects.DimensionStyle.LeaderContentAngleStyle] [nested:byte]
550  /// <summary>
551  /// Angle for text or other leader or dimension content
552  /// </summary>
553  enum class ContentAngleStyle : unsigned char
554  {
555  /// <summary>
556  /// Annotation text is horizontal in annotation object's plane
557  /// </summary>
558  Horizontal = 0,
559  /// <summary>
560  /// Aligned with last leader direction or dimension line
561  /// </summary>
562  Aligned = 1,
563  /// <summary>
564  /// Explicit angle
565  /// </summary>
566  Rotated = 2,
567  };
568 #pragma endregion
569 
570  static ON_DimStyle::ContentAngleStyle ContentAngleStyleFromUnsigned(
571  unsigned int alignment_as_unsigned
572  );
573 
574 #pragma region RH_C_SHARED_ENUM [ON_DimStyle::leader_curve_type] [Rhino.DocObjects.DimensionStyle.LeaderCurveStyle] [nested:byte]
575  /// <summary>
576  /// Type of leader curve
577  /// </summary>
578  enum class leader_curve_type : unsigned char
579  {
580  /// <summary>
581  ///
582  /// </summary>
583  None = 0,
584  /// <summary>
585  ///
586  /// </summary>
587  Polyline = 1,
588  /// <summary>
589  ///
590  /// </summary>
591  Spline = 2
592  };
593 #pragma endregion
594 
595  static ON_DimStyle::leader_curve_type LeaderCurveTypeFromUnsigned(
596  unsigned int type_as_unsigned
597  );
598 
599 #pragma region RH_C_SHARED_ENUM [ON_DimStyle::field] [Rhino.DocObjects.DimensionStyle.Field] [nested:int]
600  // Don't change these enum values. They are used in file reading and writing.
601  /// <summary>
602  /// Field identifiers used for file i/o and getting/setting values
603  /// </summary>
604  enum class field : unsigned int
605  {
606  /// <summary></summary>
607  Unset = 0,
608 
609  /// <summary>Dimension style Name property. Cannot be inherited from parent.</summary>
610  Name = 1,
611 
612  /// <summary>Dimension style runtime model component index property. Cannot be inherited from parent.</summary>
613  Index = 2,
614 
615  /// <summary></summary>
616  ExtensionLineExtension = 3,
617  /// <summary></summary>
618  ExtensionLineOffset = 4,
619  /// <summary></summary>
620  Arrowsize = 5,
621  /// <summary></summary>
622  LeaderArrowsize = 6,
623  /// <summary></summary>
624  Centermark = 7,
625  /// <summary></summary>
626  TextGap = 8,
627  /// <summary></summary>
628  TextHeight = 9,
629  /// <summary>Linear, angular, and ordinate dimension text location above/in/below</summary>
630  DimTextLocation = 10,
631 
632  //OBSOLETE_LengthFormat_ = 11,
633 
634  /// <summary></summary>
635  LengthResolution = 12,
636  /// <summary></summary>
637  AngleFormat = 13,
638  /// <summary></summary>
639  AngleResolution = 14,
640  /// <summary></summary>
641  Font = 15,
642 
643  /// <summary>
644  /// LengthFactor is a rarely used. It applies when a model is being
645  /// drawn to a scale and the dimension length values should be
646  /// reverse scaled. For example, if a model is drawn at 1/4 scale,
647  /// a line 5 units long indicates the real world line is 20 units
648  /// long. In this case setting LengthFactor to 4 would cause
649  /// a linear dimension applied to that line to display a value of 20.
650  ///</summary>
651  LengthFactor = 16,
652 
653  /// <summary></summary>
654  Alternate = 17,
655 
656  /// <summary>
657  /// AlternateLengthFactor is a rarely used. See Length factor for
658  /// a discription of this property.
659  ///</summary>
660  AlternateLengthFactor = 18,
661 
662  //OBSOLETE_AlternateLengthFormat_ = 19,
663 
664  /// <summary></summary>
665  AlternateLengthResolution = 20,
666  /// <summary></summary>
667  Prefix = 21,
668  /// <summary></summary>
669  Suffix = 22,
670  /// <summary></summary>
671  AlternatePrefix = 23,
672  /// <summary></summary>
673  AlternateSuffix = 24,
674  /// <summary></summary>
675  DimensionLineExtension = 25,
676  /// <summary></summary>
677  SuppressExtension1 = 26,
678  /// <summary></summary>
679  SuppressExtension2 = 27,
680  /// <summary></summary>
681  ExtLineColorSource = 28,
682  /// <summary></summary>
683  DimLineColorSource = 29,
684  /// <summary></summary>
685  ArrowColorSource = 30,
686  /// <summary></summary>
687  TextColorSource = 31,
688  /// <summary></summary>
689  ExtLineColor = 32,
690  /// <summary></summary>
691  DimLineColor = 33,
692  /// <summary></summary>
693  ArrowColor = 34,
694  /// <summary></summary>
695  TextColor = 35,
696  /// <summary></summary>
697  ExtLinePlotColorSource = 36,
698  /// <summary></summary>
699  DimLinePlotColorSource = 37,
700  /// <summary></summary>
701  ArrowPlotColorSource = 38,
702  /// <summary></summary>
703  TextPlotColorSource = 39,
704  /// <summary></summary>
705  ExtLinePlotColor = 40,
706  /// <summary></summary>
707  DimLinePlotColor = 41,
708  /// <summary></summary>
709  ArrowPlotColor = 42,
710  /// <summary></summary>
711  TextPlotColor = 43,
712  /// <summary></summary>
713  ExtLinePlotWeightSource = 44,
714  /// <summary></summary>
715  DimLinePlotWeightSource = 45,
716  /// <summary></summary>
717  ExtLinePlotWeight_mm = 46,
718  /// <summary></summary>
719  DimLinePlotWeight_mm = 47,
720  /// <summary></summary>
721  ToleranceFormat = 48,
722  /// <summary></summary>
723  ToleranceResolution = 49,
724  /// <summary></summary>
725  ToleranceUpperValue = 50,
726  /// <summary></summary>
727  ToleranceLowerValue = 51,
728  /// <summary></summary>
729  AltToleranceResolution = 52,
730  /// <summary></summary>
731  ToleranceHeightScale = 53,
732  /// <summary></summary>
733  BaselineSpacing = 54,
734  /// <summary></summary>
735  DrawMask = 55,
736  /// <summary></summary>
737  MaskColorSource = 56,
738  /// <summary></summary>
739  MaskColor = 57,
740  /// <summary></summary>
741  MaskBorder = 58,
742  /// <summary></summary>
743  DimensionScale = 59,
744  /// <summary></summary>
745  DimscaleSource = 60,
746  /// <summary></summary>
747  FixedExtensionLength = 61,
748  /// <summary></summary>
749  FixedExtensionOn = 62,
750  /// <summary></summary>
751  TextRotation = 63,
752  /// <summary></summary>
753  SuppressArrow1 = 64,
754  /// <summary></summary>
755  SuppressArrow2 = 65,
756  /// <summary></summary>
757  TextmoveLeader = 66,
758  /// <summary></summary>
759  ArclengthSymbol = 67,
760  /// <summary></summary>
761  StackTextheightScale = 68,
762  /// <summary></summary>
763  StackFormat = 69,
764  /// <summary></summary>
765  AltRound = 70,
766  /// <summary></summary>
767  Round = 71,
768  /// <summary></summary>
769  AngularRound = 72,
770  /// <summary></summary>
771  AltZeroSuppress = 73,
772 
773  //OBSOLETE ToleranceZeroSuppress = 74,
774 
775  /// <summary></summary>
776  AngleZeroSuppress = 75,
777  /// <summary></summary>
778  ZeroSuppress = 76,
779  /// <summary></summary>
780  AltBelow = 77,
781  /// <summary></summary>
782  ArrowType1 = 78,
783  /// <summary></summary>
784  ArrowType2 = 79,
785  /// <summary></summary>
786  LeaderArrowType = 80,
787  /// <summary></summary>
788  ArrowBlockId1 = 81,
789  /// <summary></summary>
790  ArrowBlockId2 = 82,
791  /// <summary></summary>
792  LeaderArrowBlock = 83,
793  /// <summary>Radial dimension text location above/in/below</summary>
794  DimRadialTextLocation = 84,
795  /// <summary></summary>
796  TextVerticalAlignment = 85,
797  /// <summary></summary>
798  LeaderTextVerticalAlignment = 86,
799  /// <summary></summary>
800  LeaderContentAngleStyle = 87,
801  /// <summary></summary>
802  LeaderCurveType = 88,
803  /// <summary></summary>
804  LeaderContentAngle = 89,
805  /// <summary></summary>
806  LeaderHasLanding = 90,
807  /// <summary></summary>
808  LeaderLandingLength = 91,
809  /// <summary></summary>
810  MaskFlags = 92,
811  /// <summary></summary>
812  CentermarkStyle = 93,
813  /// <summary></summary>
814  TextHorizontalAlignment = 94,
815  /// <summary></summary>
816  LeaderTextHorizontalAlignment = 95,
817  /// <summary></summary>
818  DrawForward = 96,
819  /// <summary></summary>
820  SignedOrdinate = 97,
821 
822  /// <summary>
823  /// Unit system for dimension rendering sizes like TextHeight, TextGap, ArrowSize, ExtOffset,
824  /// and dozens of other properties that control the appearance and placement of the components
825  /// used to render a dimension.
826  ///</summary>
827  UnitSystem = 98,
828 
829  /// <summary></summary>
830  TextMask = 99,
831  /// <summary></summary>
832  TextOrientation = 100,
833  /// <summary></summary>
834  LeaderTextOrientation = 101,
835  /// <summary></summary>
836  DimTextOrientation = 102,
837  /// <summary></summary>
838  DimRadialTextOrientation = 103,
839  /// <summary></summary>
840  DimTextAngleStyle = 104,
841  /// <summary></summary>
842  DimRadialTextAngleStyle = 105,
843  /// <summary></summary>
844  TextUnderlined = 106,
845 
846  //OBSOLETE_DimensionUnitSystem_ = 107,
847  //OBSOLETE_AlternateDimensionUnitSystem_ = 108,
849  /// <summary>
850  /// Dimension length display. See ON_DimStyle::DimensionLengthDisplay() for a descpription of this parameter.
851  /// </summary>
852  DimensionLengthDisplay = 109,
853 
854  /// <summary>
855  /// Alternate dimension length display. See ON_DimStyle::AlternateDimensionLengthDisplay() for a descpription of this parameter.
856  /// </summary>
857  AlternateDimensionLengthDisplay = 110,
858 
859  /// <summary>Every enum UINT value that identifies a valid dimension style property is less than the UINT value of Count.</summary>
860  Count = 111
861  };
862 
863 #pragma endregion
864 
865  enum : unsigned int
866  {
867  // must be 1 + the maximum value of an ON_DimStyle::field enum value.
868  FieldCount = (unsigned int)field::Count
869  };
870 
871  static ON_DimStyle::field FieldFromUnsigned(
872  unsigned int field_as_unsigned
873  );
874 
875 
876 #pragma region RH_C_SHARED_ENUM [ON_DimStyle::angle_format] [Rhino.DocObjects.DimensionStyle.AngleDisplayFormat] [nested:byte]
877  /// <summary>
878  /// Display format for angles
879  /// </summary>
880  enum class angle_format : unsigned char
881  {
882  /// <summary> Decimal Degrees </summary>
883  DecimalDegrees = 0,
884  /// <summary> Degrees Minutes Seconds </summary>
885  DegMinSec = 1,
886  /// <summary> Decimal Radians </summary>
887  Radians = 2,
888  /// <summary> Decimal Gradians </summary>
889  Grads = 3
890  };
891 #pragma endregion
892 
893  static ON_DimStyle::angle_format AngleFormatFromUnsigned(
894  unsigned int format_as_unsigned
895  );
896 
897 #pragma region RH_C_SHARED_ENUM [ON_DimStyle::OBSOLETE_length_format] [Rhino.DocObjects.DimensionStyle.LengthDisplayFormat] [nested:byte]
898  /// <summary>
899  /// Obsolete format for length display - use ON_DimStyle::DimensionLengthDisplay instead
900  /// </summary>
901  enum class OBSOLETE_length_format : unsigned char
902  {
903  /// <summary>Obsolete - use ON_DimStyle::DimensionLengthDisplay::ModelUnits.</summary>
904  Decimal = 0,
905 
906  /// <summary>Obsolete - use ON_DimStyle::DimensionLengthDisplay::InchesFractional</summary>
907  Fractional = 1,
908 
909  /// <summary>Obsolete - use ON_DimStyle::DimensionLengthDisplay::FeetAndInches</summary>
910  FeetInches = 2,
911 
912  /// <summary>Obsolete - use ON_DimStyle::DimensionLengthDisplay::FeetAndInches enum.</summary>
913  FeetDecimalInches = 3
914  };
915 #pragma endregion
916 
917 
918  static ON_DimStyle::OBSOLETE_length_format OBSOLETE_LengthFormatFromUnsigned(
919  unsigned int format_as_unsigned
920  );
921 
922  /*
923  Parameters:
924  dimension_length_display - [in]
925  model_serial_number - [in]
926  0: Ignore model settings
927  >0: dimstyle.ModelSerialNumber()
928  */
929  static ON_DimStyle::OBSOLETE_length_format OBSOLETE_LengthFormatFromLengthDisplay(
930  ON_DimStyle::LengthDisplay dimension_length_display,
931  unsigned int model_serial_number
932  );
933 
934  static ON_DimStyle::OBSOLETE_length_format OBSOLETE_LengthFormatFromLengthDisplay(
935  ON_DimStyle::LengthDisplay dimension_length_display,
936  ON::LengthUnitSystem model_unit_system
937  );
938 
939 #pragma region RH_C_SHARED_ENUM [ON_DimStyle::TextLocation] [Rhino.DocObjects.DimensionStyle.TextLocation] [nested:byte]
940  /// <summary>
941  /// The location of text in linear, angular, radial, and ordinate dimensions.
942  /// </summary>
943  enum class TextLocation : unsigned char
944  {
945  /// <summary>Text is above dimension line.</summary>
946  AboveDimLine = 0,
947  /// <summary>Text is centered in dimension line.</summary>
948  InDimLine = 1,
949  /// <summary>Text is below dimension line.</summary>
950  BelowDimLine = 2
951  };
952 #pragma endregion
953 
954  static ON_DimStyle::TextLocation TextLocationFromUnsigned(
955  unsigned int dim_text_location_as_unsigned
956  );
957 
958  // convert ON_DimStyle::OBSOLETE_length_format enum to ON::OBSOLETE_DistanceDisplayMode enum
959  static ON::OBSOLETE_DistanceDisplayMode DistanceDisplayModeFromLengthFormat(
961  );
962 
963  // convert ON::OBSOLETE_DistanceDisplayMode enum to ON_DimStyle::OBSOLETE_length_format enum
964  static ON_DimStyle::OBSOLETE_length_format LengthFormatFromDistanceDisplayMode(
965  ON::OBSOLETE_DistanceDisplayMode
966  );
967 
968 
969 #pragma region RH_C_SHARED_ENUM [ON_DimStyle::suppress_zero] [Rhino.DocObjects.DimensionStyle.ZeroSuppression] [nested:byte]
970  /// <summary>
971  /// Marks leading and trailing zeros for removal.
972  /// </summary>
973  enum class suppress_zero : unsigned char
974  {
975  /// <summary>No zero suppression.</summary>
976  None = 0,
977  /// <summary>Suppress leading zeros.</summary>
978  SuppressLeading = 1,
979  /// <summary>Suppress trailing zeros.</summary>
980  SuppressTrailing = 2,
981  /// <summary>Suppress leading and trailing zeros.</summary>
982  SuppressLeadingAndTrailing = 3,
983  /// <summary>Suppress zero feet.</summary>
984  SuppressZeroFeet = 4,
985  /// <summary>Suppress zero inches.</summary>
986  SuppressZeroInches = 8,
987  /// <summary>Suppress zero feet and zero inches.</summary>
988  SuppressZeroFeetAndZeroInches = 12
989  };
990 #pragma endregion
991 
992  static ON_DimStyle::suppress_zero ZeroSuppressFromUnsigned(
993  unsigned int suppress_ero_as_unsigned
994  );
995 
996 #pragma region RH_C_SHARED_ENUM [ON_DimStyle::stack_format] [Rhino.DocObjects.DimensionStyle.StackDisplayFormat] [nested:byte]
997  /// <summary>
998  /// Format of stacked fractions
999  /// </summary>
1000  enum class stack_format : unsigned char
1001  {
1002  /// <summary> No stacking </summary>
1003  None = 0,
1004  /// <summary> Stack with horizontal line </summary>
1005  StackHorizontal = 1,
1006  /// <summary> Stack with angled line </summary>
1007  StackDiagonal = 2,
1008  };
1009 #pragma endregion
1010 
1011  static ON_DimStyle::stack_format StackFormatFromUnsigned(
1012  unsigned int format_as_unsigned
1013  );
1014 
1015 #pragma region RH_C_SHARED_ENUM [ON_DimStyle::centermark_style] [Rhino.DocObjects.DimensionStyle.CenterMarkStyle] [nested:byte]
1016  /// <summary>
1017  /// Style for drawing centermark for Radial dimensions and Centermark objects
1018  /// </summary>
1019  enum class centermark_style : unsigned char
1020  {
1021  /// <summary>
1022  /// No centermark display
1023  /// </summary>
1024  None = 0,
1025  /// <summary>
1026  /// + mark only
1027  /// </summary>
1028  Mark = 1,
1029  /// <summary>
1030  /// + mark and lines to radius
1031  /// </summary>
1032  MarkAndLines = 2,
1033  };
1034 #pragma endregion
1035 
1036  static ON_DimStyle::centermark_style CentermarkStyleFromUnsigned(
1037  unsigned int centermark_as_unsigned
1038  );
1039 
1040 
1041  static ON_DimStyle::LengthDisplay LengthDisplayFromUnitsAndFormat(
1042  ON::LengthUnitSystem units,
1044  );
1045 
1046  /// <summary>
1047  /// Dimension length units and format
1048  ///</summary>
1049  ON_DimStyle::LengthDisplay DimensionLengthDisplay() const;
1050 
1051  /// <summary>
1052  /// Set dimension length units and format
1053  ///</summary>
1054  ON_DimStyle::LengthDisplay AlternateDimensionLengthDisplay() const;
1055 
1056  /// <summary>
1057  /// Alternate dimension length units and format
1058  ///</summary>
1059  void SetDimensionLengthDisplay(ON_DimStyle::LengthDisplay length_display);
1060 
1061  /// <summary>
1062  /// Set alternate dimension length units and format
1063  ///</summary>
1064  void SetAlternateDimensionLengthDisplay(ON_DimStyle::LengthDisplay length_display);
1065 
1066  /// <summary>
1067  /// Parameters:
1068  /// model_sn - 0, a model serial number, or ON_UNSET_UINT_INDEX to
1069  /// use the dimstyle's ModelSerialNumber() value.
1070  /// Returns
1071  /// Unit system for dimension length display.
1072  /// If DimensionLengthDisplay() == ON_DimStyle::LengthDisplay::ModelUnits
1073  /// and model_sn > 0, then the value of ON::LengthUnitSystemFromModelSerialNumber(model_sn)
1074  /// is returned.
1075  /// If DimensionLengthDisplay() == ON_DimStyle::LengthDisplay::ModelUnits
1076  /// and model_sn == 0, then ON::LengthUnitSystem::None is returned.
1077  ///</summary>
1078  ON::LengthUnitSystem DimensionLengthDisplayUnit(
1079  unsigned int model_sn
1080  ) const;
1081 
1082  /// <summary>
1083  /// Parameters:
1084  /// model_sn - 0, a model serial number, or ON_UNSET_UINT_INDEX to
1085  /// use the dimstyle's ModelSerialNumber() value.
1086  /// Returns
1087  /// Unit system for dimension length display.
1088  /// If DimensionLengthDisplay() == ON_DimStyle::LengthDisplay::ModelUnits
1089  /// and model_sn > 0, then the value of ON::LengthUnitSystemFromModelSerialNumber(model_sn)
1090  /// is returned.
1091  /// If DimensionLengthDisplay() == ON_DimStyle::LengthDisplay::ModelUnits
1092  /// and model_sn == 0, then ON::LengthUnitSystem::None is returned.
1093  ///</summary>
1094  ON::LengthUnitSystem AlternateDimensionLengthDisplayUnit(
1095  unsigned int model_sn
1096  ) const;
1097 
1098 private:
1099  /*
1100  Returns:
1101  true if value was changed.
1102  */
1103  bool Internal_SetBoolMember(
1104  ON_DimStyle::field field_id,
1105  bool value,
1106  bool& class_member
1107  );
1108  /*
1109  Returns:
1110  true if value was changed.
1111  */
1112  bool Internal_SetUnsignedCharMember(
1113  ON_DimStyle::field field_id,
1114  unsigned char value,
1115  unsigned char& class_member
1116  );
1117  /*
1118  Returns:
1119  true if value was changed.
1120  */
1121  bool Internal_SetIntMember(
1122  ON_DimStyle::field field_id,
1123  int value,
1124  int& class_member
1125  );
1126  /*
1127  Returns:
1128  true if value was changed.
1129  */
1130  bool Internal_SetColorMember(
1131  ON_DimStyle::field field_id,
1132  ON_Color value,
1133  ON_Color& class_member
1134  );
1135  /*
1136  Returns:
1137  true if value was changed.
1138  */
1139  bool Internal_SetDoubleMember(
1140  ON_DimStyle::field field_id,
1141  double value,
1142  double& class_member
1143  );
1144  /*
1145  Returns:
1146  true if value was changed.
1147  */
1148  bool Internal_SetIdMember(
1149  ON_DimStyle::field field_id,
1150  ON_UUID value,
1151  ON_UUID& class_member
1152  );
1153  /*
1154  Returns:
1155  true if value was changed.
1156  */
1157  bool Internal_SetStringMember(
1158  ON_DimStyle::field field_id,
1159  const wchar_t* value,
1160  ON_wString& class_member
1161  );
1162 
1163  void Internal_SetOverrideDimStyleCandidateFieldOverride(ON_DimStyle::field field_id);
1164 
1165 public:
1166  // Extension line extension
1167  double ExtExtension() const;
1168  void SetExtExtension(const double);
1169 
1170  // Extension line offset
1171  double ExtOffset() const;
1172  void SetExtOffset(const double);
1173 
1174  // Arrow size
1175  double ArrowSize() const;
1176  void SetArrowSize(const double);
1177 
1178  // Arrow size
1179  double LeaderArrowSize() const;
1180  void SetLeaderArrowSize(const double);
1181 
1182  // Centermark size
1183  double CenterMark() const;
1184  void SetCenterMark(const double);
1185 
1186  // Centermark style
1187  ON_DimStyle::centermark_style CenterMarkStyle() const;
1188  void SetCenterMarkStyle(ON_DimStyle::centermark_style style);
1189 
1190  // The location of text relative to the dimension line in linear, angular, and ordinate dimensions.
1191  ON_DimStyle::TextLocation DimTextLocation() const;
1192  void SetDimTextLocation(ON_DimStyle::TextLocation);
1193 
1194  // The location of text relative to the dimension line in radial dimensions.
1195  ON_DimStyle::TextLocation DimRadialTextLocation() const;
1196  void SetDimRadialTextLocation(ON_DimStyle::TextLocation);
1197 
1198  angle_format AngleFormat() const;
1199  void SetAngleFormat(angle_format format);
1200 
1201  // Display resolution for distance measurements
1202  int LengthResolution() const;
1203  void SetLengthResolution(int);
1204 
1205  // Display resolution for angle measurements
1206  int AngleResolution() const;
1207  void SetAngleResolution(int);
1208 
1209 public:
1210  /*
1211  Description:
1212  Set the font used to render text.
1213  Parameters:
1214  font_characteristics - [in]
1215  This parameter does not have to be a managed font.
1216  Remarks:
1217  If the parameter is a managed font (font_characteristics.IsManagedFont() is true),
1218  then the identical value is returned by ON_DimStyle.Font().
1219  If the parameter is not a managed font (font_characteristics.IsManagedFont() is false),
1220  then the ON_Font::GetManagedFont(font_characteristics) will be returned by
1221  ON_DimStyle.Font().
1222  */
1223  void SetFont(
1224  const class ON_Font& font_characteristics
1225  );
1226 
1227  /*
1228  Returns:
1229  The managed font used to render text.
1230  */
1231  const class ON_Font& Font() const;
1232 
1233  /*
1234  Returns:
1235  A copy of the font_characteristics information.
1236  Remarks:
1237  You probably want to use Font(). This function is only useful
1238  in isolated situations and is typically used to study font
1239  substitutions when a model moves between computers or platforms.
1240  */
1241  const class ON_Font& FontCharacteristics() const;
1242 
1243  /*
1244  Returns:
1245  True if the font returned by Font() is a substitute
1246  for the font passed to SetFont().
1247  Remarks:
1248  Font substitution can occur when a model is moved between
1249  computers that have different fonts installed.
1250  */
1251  const bool FontSubstituted() const;
1252 
1253 public:
1254  /*
1255  Description:
1256  Two dimension styles have identical text orientation, glyph content,
1257  and size parameters if and only if the have identical values of
1258  TextPositionPropertiesHash().
1259  Returns:
1260  A SHA-1 hash of the information that controls text position and size.
1261  Remarks:
1262  Independent of id, parent id, name, and index.
1263  */
1264  const class ON_SHA1_Hash TextPositionPropertiesHash() const;
1265 
1266  /*
1267  Description:
1268  Two dimension styles have identical content if and only
1269  if they have identical values of ContentHash().
1270  Returns:
1271  A SHA-1 hash of the information that controls annotation appearance.
1272  Remarks:
1273  Independent of id, parent id, name, and index.
1274  */
1275  const class ON_SHA1_Hash& ContentHash() const;
1276 
1277 private:
1278  void Internal_TextPositionPropertiesChange();
1279 
1280 public:
1281 
1282  // Distance from dimension lines to text
1283  double TextGap() const;
1284  void SetTextGap(double gap);
1285 
1286  // Height of dimension text
1287  double TextHeight() const;
1288  void SetTextHeight(double height);
1289 
1290  /// <summary>
1291  /// LengthFactor is a rarely used. It applies when a model is being
1292  /// drawn to a scale and the dimension length values should be
1293  /// reverse scaled. For example, if a model is drawn at 1/4 scale,
1294  /// a line 5 units long indicates the real world line is 20 units
1295  /// long. In this case setting LengthFactor to 4 would cause
1296  /// a linear dimension applied to that line to display a value of 20.
1297  ///</summary>
1298  double LengthFactor() const;
1299 
1300  /// <summary>
1301  /// LengthFactor is a rarely used. It applies when a model is being
1302  /// drawn to a scale and the dimension length values should be
1303  /// reverse scaled. For example, if a model is drawn at 1/4 scale,
1304  /// a line 5 units long indicates the real world line is 20 units
1305  /// long. In this case setting LengthFactor to 4 would cause
1306  /// a linear dimension applied to that line to display a value of 20.
1307  ///</summary>
1308  void SetLengthFactor(double);
1309 
1310  // Additional measurement display toggle
1311  bool Alternate() const;
1312  void SetAlternate(bool);
1313 
1314  // Distance scale factor for alternate display
1315  /// <summary>
1316  /// AlternateLengthFactor is a rarely used. See Length factor for
1317  /// a discription of this property.
1318  ///</summary>
1319  double AlternateLengthFactor() const;
1320 
1321  /// <summary>
1322  /// AlternateLengthFactor is a rarely used. See Length factor for
1323  /// a discription of this property.
1324  ///</summary>
1325  void SetAlternateLengthFactor(double);
1326 
1327  // Display resolution for alternate length measurements
1328  int AlternateLengthResolution() const;
1329  void SetAlternateLengthResolution(int);
1330 
1331  // Dimension prefix text
1332  const ON_wString& Prefix() const;
1333  void SetPrefix(const wchar_t*);
1334 
1335  // Dimension suffix text
1336  const ON_wString& Suffix() const;
1337  void SetSuffix(const wchar_t*);
1338 
1339  // Dimension alternate prefix text
1340  const ON_wString& AlternatePrefix() const;
1341  void SetAlternatePrefix(const wchar_t*);
1342 
1343  // Dimension alternate suffix text
1344  const ON_wString& AlternateSuffix() const;
1345  void SetAlternateSuffix(const wchar_t*);
1347  // Suppress first dimension extension line
1348  bool SuppressExtension1() const;
1349  void SetSuppressExtension1(bool);
1350 
1351  // Suppress second dimension extension line
1352  bool SuppressExtension2() const;
1353  void SetSuppressExtension2(bool);
1354 
1355  // Extension of dimension line past extension lines
1356  double DimExtension() const;
1357  void SetDimExtension(const double e);
1358 
1359 
1360  //// Colors of Text
1361  //ON_Color TextColor() const;
1362  //void SetTextColor(ON_Color color);
1363  //
1364  // Combines a field id and a field value
1365  // Dimensions will have an array of DimstyleField's to record
1366  // dimension style overrides for individual dimensions
1368  {
1369  public:
1370  DimstyleField()
1371  : m_next(nullptr)
1372  , m_field_id(ON_DimStyle::field::Unset)
1373  {
1374  m_val.s_val = nullptr;
1375  }
1376  ~DimstyleField()
1377  {
1378  if (nullptr != m_next)
1379  {
1380  delete m_next;
1381  m_next = nullptr;
1382  }
1383  if (nullptr != m_val.s_val)
1384  {
1385  delete m_val.s_val;
1386  m_val.s_val = nullptr;
1387  }
1388  }
1389 
1390  DimstyleField* m_next;
1391  ON_DimStyle::field m_field_id;
1392  union
1393  {
1394  bool b_val;
1395  int i_val;
1396  unsigned char uc_val;
1397  double d_val;
1398  unsigned int c_val;
1399  const ON_wString* s_val;
1400  } m_val;
1401  };
1402 
1403  /*
1404  Parameters:
1405  field_id - [in]
1406  Returns:
1407  false: (default)
1408  The setting identified by field_id is inherited from the parent dimension style identified by ParentId().
1409  true:
1410  The setting identified by field_id is independet of any parent dimension style.
1411  */
1412  bool IsFieldOverride(ON_DimStyle::field field_id) const;
1413 
1414  /*
1415  Parameters:
1416  field_id - [in]
1417  bOverrideParent - [in]
1418  false:
1419  The setting identified by field_id is inherited from the parent dimension style identified by ParentId().
1420  true:
1421  The setting identified by field_id is independent of any parent dimension style.
1422  */
1423  void SetFieldOverride(ON_DimStyle::field field_id, bool bOverrideParent);
1424 
1425  /*
1426  Parameters:
1427  bOverrideParent - [in]
1428  true - if a field permits overriding, set it to true.
1429  false - set all field override values to false.
1430  */
1431  void SetFieldOverrideAll(bool bOverrideParent);
1432 
1433  /*
1434  Description:
1435  All dimension style settings identified the ON_DimStyle::field enum,
1436  except Name and Id, are inherited from the parent dimension style.
1437  */
1438  void ClearAllFieldOverrides();
1439 
1440  /*
1441  Returns:
1442  false: (default)
1443  Every setting identified by a ON_DimStyle::field enum value, except name and id,
1444  is inherited from the parent dimension style identified by ParentId().
1445  true:
1446  At least one setting identified by a ON_DimStyle::field enum value is
1447  is independent of any parent dimension style.
1448  */
1449  bool HasOverrides() const;
1450 
1451  /*
1452  Returns:
1453  The content hash of the parent dimstyle. If there is no parent dimstyle, then
1454  ON_SHA1_Hash::EmptyContent is returned.
1455  */
1456  const ON_SHA1_Hash& ParentContentHash() const;
1457 
1458  /*
1459  Description:
1460  Create a dimstyle from this that is configured to be customized for use
1461  in creating a new annotation object.
1462  Example:
1463  ON_DimStyleContext = dim_style_context = ...;
1464  ON_DimStyle my_dim_style = dim_style_context.CurrentDimStyle().CreateOverrideCandidate().
1465  // Customize my_dim_style
1466  my_dim_style.Set...(...);
1467  Returns:
1468  An ON_DimStyle configured to be modified and used as an override dimstyle for annotation objects.
1469  */
1470  const ON_DimStyle CreateOverrideCandidate() const;
1471 
1472  /*
1473  Description:
1474  Get an ON_DimStyle with the specified properties.
1475  Parameters:
1476  parent_dim_style - [in]
1477  If you are getting ready to modify and existing annotation object,
1478  a good options for this paramter is the dimstyle returned by ON_Annotation.DimStyle();
1479  If you are getting ready to create a new annotation object, then get
1480  an ON_DimStyleContext class and pass ON_DimStyleContext.CurrentDimStyle().
1481  In Rhino, use CRhinoDoc.DimStyleContext() to get an ON_DimStyleContext.
1482  In an ONX_Model, use ONX_Model.DimStyleContext() to get an ON_DimStyleContext.
1483  In other situations, you can pass on of the system dimstyles like
1484  ON_DimStyle::DefaultMillimeterSmall or ON_DimStyle::DefaultMillimeterArchitecture.
1485  The worst possible choices are ON_DimStyle::Default or ON_DimStyle::Unset.
1486  annotation_type - [in]
1487  ON::AnnotationType::Unset if style will be used for multiple types of annotation
1488  or a specific type. For example, if you are making a text object, pass ON::AnnotationType::Text;
1489  if you are making a leader, pass ON::AnnotationType::Leader, and so on.
1490  font - [in]
1491  nullptr for current default or specify the font you want.
1492  When in doubt, pass nullptr
1493  model_space_text_scale - [in]
1494  If > 0, then ON_DimStyle.DimScale() is set, otherwise current default is used.
1495  When in doubt, pass ON_UNSET_VALUE.
1496  text_height - [in]
1497  text_height_unit_system - [in]
1498  If text_height > 0, then ON_DimStyle.TextHeight() is set, otherwise current default is used.
1499  When in doubt, pass ON_UNSET_VALUE.
1500  valign - [in]
1501  halign - [in]
1502  valign and halign control placement of text in text objects and leaders.
1503  The value of the annotation_type parameter determines which objects use the
1504  valign and halign settings.
1505  text_orientation - [in]
1506  dim_text_location - [in]
1507  Controls placement of text in linear, angular, radial and ordinate dimensions.
1508  When in doubt, pass parent_dim_style.DimTextLocation().
1509  Returns:
1510  A dimstyle with the specified text properties.
1511  Remarks:
1512  This is a useful tool for creating the dimension style parameters to
1513  CRhinoDoc.AddTextObject() and CRhinoDoc.AddLeaderObject().
1514  */
1515  static const ON_DimStyle CreateFromProperties(
1516  const ON_DimStyle& parent_dim_style,
1517  ON::AnnotationType annotation_type,
1518  const ON_Font* font,
1519  double model_space_text_scale,
1520  double text_height,
1521  ON::LengthUnitSystem text_height_unit_system,
1522  ON::TextVerticalAlignment valign,
1523  ON::TextHorizontalAlignment halign
1524  );
1525 
1526  static const ON_DimStyle CreateFromProperties(
1527  const ON_DimStyle& parent_dim_style,
1528  ON::AnnotationType annotation_type,
1529  const ON_Font* font,
1530  double model_space_text_scale,
1531  double text_height,
1532  ON::LengthUnitSystem text_height_unit_system,
1533  ON::TextVerticalAlignment valign,
1534  ON::TextHorizontalAlignment halign,
1535  ON::TextOrientation orientation,
1536  ON_DimStyle::TextLocation dim_text_location
1537  );
1538 
1539  static const ON_DimStyle CreateFromProperties(
1540  const ON_DimStyle& parent_dim_style,
1541  ON::AnnotationType annotation_type,
1542  const ON_Font* font,
1543  double model_space_text_scale,
1544  double text_height,
1545  ON::LengthUnitSystem text_height_unit_system
1546  );
1547 
1548 private:
1549  static void Internal_CreateFromProperties(
1550  const ON_DimStyle& parent_dim_style,
1551  ON::AnnotationType annotation_type,
1552  const ON_Font* font,
1553  double model_space_text_scale,
1554  double text_height,
1555  ON::LengthUnitSystem text_height_unit_system,
1556  bool bSetAlignment,
1557  ON::TextVerticalAlignment valign,
1558  ON::TextHorizontalAlignment halign,
1559  bool bSetOrientation,
1560  ON::TextOrientation orientation,
1561  bool bSetLocation,
1562  ON_DimStyle::TextLocation dim_text_location,
1563  ON_DimStyle& destination
1564  );
1565 public:
1566 
1567  /*
1568 
1569  */
1570  bool IsOverrideDimStyleCandidate(
1571  ON_UUID parent_id,
1572  bool bRequireSetOverrides,
1573  ON_wString* error_description = nullptr
1574  ) const;
1575 
1576 
1577  /*
1578  Description:
1579  For every dimension style property identified by a field_id ON_DimStyle::field enum,
1580  except Name and Index, do the following:
1581 
1582  if ( source.IsFieldOverride(field_id) )
1583  copy corresponding value from source to this
1584  else
1585  copy corresponding value from parent to this
1586 
1587  Set this->ParentId() = parent.Id().
1588  Parameters:
1589  src - [in]
1590  It is permitted for src to be this.
1591  parent - [in]
1592  It is permitted for parent to be this.
1593  */
1594  void OverrideFields(
1595  const ON_DimStyle& source,
1596  const ON_DimStyle& parent
1597  );
1598 
1599  /*
1600  Description:
1601  For every dimension style property identified by a field_id ON_DimStyle::field enum,
1602  except Name and Index, if source and parent have different values, then
1603  set the field overide for that property to true.
1604  Parameters:
1605  src - [in]
1606  It is permitted for src to be this.
1607  parent - [in]
1608  It is permitted for parent to be this.
1609  */
1610  void OverrideFieldsWithDifferentValues(
1611  const ON_DimStyle& source,
1612  const ON_DimStyle& parent
1613  );
1614 
1615  /*
1616  Descripton:
1617  Set the parent dimension style id to parent.Id() and copies
1618  all inherited appearance properties from parent.
1619  Parameters:
1620  parent - [in]
1621  If this->IsFieldOverride(field_id) is false, then the dimension style
1622  property value corresponding to field_id is copied from parent to "this".
1623  Remarks:
1624  Identical to calling this->OverrideFields(*this,parent).
1625  */
1626  void InheritFields(const ON_DimStyle& parent);
1627 
1628  // Test if this dimstyle is the child of any other dimstyle
1629  bool IsChildDimstyle() const;
1630 
1631  /*
1632  Returns:
1633  True if parent_id is not nil and parent_id == this->ParentId().
1634  */
1635  bool IsChildOf(const ON_UUID& parent_id) const;
1636 
1637  tolerance_format ToleranceFormat() const;
1638  int ToleranceResolution() const;
1639  double ToleranceUpperValue() const;
1640  double ToleranceLowerValue() const;
1641  double ToleranceHeightScale() const;
1642 
1643  void SetToleranceFormat(ON_DimStyle::tolerance_format format);
1644  void SetToleranceResolution(int resolution);
1645  void SetToleranceUpperValue(double upper_value);
1646  void SetToleranceLowerValue(double lower_value);
1647  void SetToleranceHeightScale(double scale);
1648 
1649  double BaselineSpacing() const;
1650  void SetBaselineSpacing(double spacing);
1651 
1652  // Determines whether or not to draw a Text Mask
1653  bool DrawTextMask() const;
1654  void SetDrawTextMask(bool bDraw);
1655 
1656  // Determines where to get the color to draw a Text Mask
1657  ON_TextMask::MaskType MaskFillType() const;
1658  void SetMaskFillType(ON_TextMask::MaskType source);
1659 
1660  ON_Color MaskColor() const; // Only works right if MaskColorSource returns 1.
1661  // Does not return viewport background color
1662  void SetMaskColor(ON_Color color);
1663 
1664  // Offset for the border around text to the rectangle used to draw the mask
1665  // This number is the offset on each side of the tight rectangle around the
1666  // text characters to the mask rectangle.
1667  double MaskBorder() const;
1668  void SetMaskBorder(double offset);
1669 
1670  // The ON_TextMask class contains the property values for
1671  // DrawTextMask()
1672  // MaskColor()
1673  // MaskFillType()
1674  // MaskBorder()
1675  // Use the
1676  // SetDrawTextMask()
1677  // SetMaskColor()
1678  // SetMaskFillType()
1679  // SetMaskBorder()
1680  // functions to modify text mask properties.
1681  const ON_TextMask& TextMask() const;
1682  void SetTextMask(const ON_TextMask& text_mask);
1683 
1684 private:
1685  void Internal_SetTextMask(
1686  const ON_TextMask& text_mask
1687  );
1688 public:
1689 
1690  void Scale(double scale);
1691 
1692  // UUID of the dimstyle this was originally copied from
1693  // so Restore Defaults has some place to look
1694  void SetSourceDimstyle(ON_UUID source_uuid);
1695  ON_UUID SourceDimstyle() const;
1696 
1697  void SetExtensionLineColorSource(const ON::object_color_source src);
1698  ON::object_color_source ExtensionLineColorSource() const;
1699  void SetDimensionLineColorSource(const ON::object_color_source src);
1700  ON::object_color_source DimensionLineColorSource() const;
1701  void SetArrowColorSource(const ON::object_color_source src);
1702  ON::object_color_source ArrowColorSource() const;
1703  void SetTextColorSource(const ON::object_color_source src);
1704  ON::object_color_source TextColorSource() const;
1705  void SetExtensionLineColor(ON_Color c);
1706  ON_Color ExtensionLineColor() const;
1707  void SetDimensionLineColor(ON_Color c);
1708  ON_Color DimensionLineColor() const;
1709  void SetArrowColor(ON_Color c);
1710  ON_Color ArrowColor() const;
1711  void SetTextColor(ON_Color c);
1712  ON_Color TextColor() const;
1713 
1714  void SetExtensionLinePlotColorSource(const ON::plot_color_source src);
1715  ON::plot_color_source ExtensionLinePlotColorSource() const;
1716  void SetDimensionLinePlotColorSource(const ON::plot_color_source src);
1717  ON::plot_color_source DimensionLinePlotColorSource() const;
1718  void SetArrowPlotColorSource(const ON::plot_color_source src);
1719  ON::plot_color_source ArrowPlotColorSource() const;
1720  void SetTextPlotColorSource(const ON::object_color_source src);
1721  ON::object_color_source TextPlotColorSource() const;
1722  void SetExtensionLinePlotColor(ON_Color c);
1723  ON_Color ExtensionLinePlotColor() const;
1724  void SetDimensionLinePlotColor(ON_Color c);
1725  ON_Color DimensionLinePlotColor() const;
1726  void SetArrowPlotColor(ON_Color c);
1727  ON_Color ArrowPlotColor() const;
1728  void SetTextPlotColor(ON_Color c);
1729  ON_Color TextPlotColor() const;
1730 
1731  void SetExtensionLinePlotWeightSource(const ON::plot_weight_source src);
1732  ON::plot_weight_source ExtensionLinePlotWeightSource() const;
1733  void SetDimensionLinePlotWeightSource(const ON::plot_weight_source src);
1734  ON::plot_weight_source DimensionLinePlotWeightSource() const;
1735  void SetExtensionLinePlotWeight(double w);
1736  double ExtensionLinePlotWeight() const;
1737  void SetDimensionLinePlotWeight(double w);
1738  double DimensionLinePlotWeight() const;
1739 
1740  void SetFixedExtensionLen(double l);
1741  double FixedExtensionLen() const;
1742  void SetFixedExtensionLenOn(bool on);
1743  bool FixedExtensionLenOn() const;
1744 
1745  void SetTextRotation(double r);
1746  double TextRotation() const;
1747 
1748  void SetAlternateToleranceResolution(int r);
1749  int AlternateToleranceResolution() const;
1750 
1751  void SetSuppressArrow1(bool s);
1752  bool SuppressArrow1() const;
1753  void SetSuppressArrow2(bool s);
1754  bool SuppressArrow2() const;
1755  void SetTextMoveLeader(int m);
1756 
1757  int TextMoveLeader() const;
1758  void SetArcLengthSymbol(int m);
1759  int ArcLengthSymbol() const;
1760 
1761  void SetStackFractionFormat(ON_DimStyle::stack_format f);
1762  ON_DimStyle::stack_format StackFractionFormat() const;
1763  void SetStackHeightScale(double f);
1764  double StackHeightScale() const;
1765 
1766  void SetRoundOff(double r);
1767  double RoundOff() const;
1768  void SetAlternateRoundOff(double r);
1769  double AlternateRoundOff() const;
1770  void SetAngleRoundOff(double r);
1771  double AngleRoundOff() const;
1772  void SetZeroSuppress(ON_DimStyle::suppress_zero s);
1773  ON_DimStyle::suppress_zero ZeroSuppress() const;
1774  void SetAlternateZeroSuppress(ON_DimStyle::suppress_zero s);
1775  ON_DimStyle::suppress_zero AlternateZeroSuppress() const;
1776 
1777  // OBSOLETE - The ZeroSuppress() or AlternateZeroSuppress() property
1778  // is used to format tolerance display. ToleranceZeroSuppress() is ignored.
1779  void SetToleranceZeroSuppress(ON_DimStyle::suppress_zero s);
1780 
1781  // OBSOLETE - The ZeroSuppress() or AlternateZeroSuppress() property
1782  // is used to format tolerance display. ToleranceZeroSuppress() is ignored.
1783  ON_DimStyle::suppress_zero ToleranceZeroSuppress() const;
1784 
1785  void SetAngleZeroSuppress(ON_DimStyle::suppress_zero s);
1786  ON_DimStyle::suppress_zero AngleZeroSuppress() const;
1787  void SetAlternateBelow(bool below);
1788 
1789  /*
1790  Description:
1791  The valid choices for ON_DimStyle::suppress_zero depend on
1792  the dimension length display.
1793  Parameters:
1794  zero_suppress - [in]
1795  length_display - [in]
1796  Returns:
1797  True if zero_suppression is a valid setting when
1798  DimensionLengthDiplay = dimension_length_display
1799  Remarks:
1800  LengthDisplay: Inch fractional – No zero suppression matches
1801  LengthDisplay : FeetAndInches – Zero suppress can be
1802  None,
1803  Suppress zero feet,
1804  Suppress zero inches or
1805  Suppress zero feet and zero inches.
1806  LengthDisplay : ModelUnits or any Decimal mode – Zero suppress can be
1807  None,
1808  Suppress leading,
1809  Suppress trailing or
1810  Suppress leading and trailing.
1811  */
1812  static bool ZeroSuppressMatchesLengthDisplay(
1813  ON_DimStyle::suppress_zero zero_suppress,
1814  ON_DimStyle::LengthDisplay length_display);
1815 
1816  bool AlternateBelow() const;
1817 
1818  ON_Arrowhead::arrow_type ArrowType1() const;
1819  void SetArrowType1(ON_Arrowhead::arrow_type);
1820  ON_Arrowhead::arrow_type ArrowType2() const;
1821  void SetArrowType2(ON_Arrowhead::arrow_type);
1822  void SetArrowType1And2(ON_Arrowhead::arrow_type);
1823  ON_Arrowhead::arrow_type LeaderArrowType() const;
1824  void SetLeaderArrowType(ON_Arrowhead::arrow_type);
1825 
1826  void SetArrowBlockId1(ON_UUID id);
1827  ON_UUID ArrowBlockId1() const;
1828  void SetArrowBlockId2(ON_UUID id);
1829  ON_UUID ArrowBlockId2() const;
1830  void SetLeaderArrowBlockId(ON_UUID id);
1831  ON_UUID LeaderArrowBlockId() const;
1832 
1833  ON::TextVerticalAlignment TextVerticalAlignment() const;
1834  void SetTextVerticalAlignment(ON::TextVerticalAlignment style);
1835  ON::TextVerticalAlignment LeaderTextVerticalAlignment() const; // was attachstyle
1836  void SetLeaderTextVerticalAlignment(ON::TextVerticalAlignment style);
1837  ON_DimStyle::ContentAngleStyle LeaderContentAngleStyle() const; // was contentalignment
1838  void SetLeaderContentAngleStyle(ON_DimStyle::ContentAngleStyle style);
1839  ON_DimStyle::leader_curve_type LeaderCurveType() const;
1840  void SetLeaderCurveType(ON_DimStyle::leader_curve_type type);
1841  bool LeaderHasLanding() const;
1842  void SetLeaderHasLanding(bool landing);
1843  double LeaderLandingLength() const;
1844  void SetLeaderLandingLength(double length);
1845  double LeaderContentAngleRadians() const;
1846  void SetLeaderContentAngleRadians(double angle_radians);
1847  double LeaderContentAngleDegrees() const;
1848  void SetLeaderContentAngleDegrees(double angle_degrees);
1849  ON::TextHorizontalAlignment TextHorizontalAlignment() const;
1850  void SetTextHorizontalAlignment(ON::TextHorizontalAlignment halign);
1851  ON::TextHorizontalAlignment LeaderTextHorizontalAlignment() const;
1852  void SetLeaderTextHorizontalAlignment(ON::TextHorizontalAlignment halign);
1853  bool DrawForward() const;
1854  void SetDrawForward(bool drawforward);
1855  bool SignedOrdinate() const;
1856  void SetSignedOrdinate(bool allowsigned);
1857 
1858  /// <summary>
1859  /// Unit system for dimension rendering sizes like TextHeight, TextGap, ArrowSize, ExtOffset,
1860  /// and dozens of other properties that control the appearance and placement of the components
1861  /// used to render a dimension.
1862  ///</summary>
1863  ON::LengthUnitSystem UnitSystem() const;
1864 
1865  /// <summary>
1866  /// Unit system for dimension rendering sizes like TextHeight, TextGap, ArrowSize, ExtOffset,
1867  /// and dozens of other properties that control the appearance and placement of the components
1868  /// used to render a dimension.
1869  ///</summary>
1870  void SetUnitSystem(ON::LengthUnitSystem us);
1871 
1872  /*
1873  Description:
1874  When a dimension style unit system is not set,
1875  this function examines the context the dimension style is
1876  being used in and sets the unit system.
1877  Parameters:
1878  bUseName - [in]
1879  Consider the name when assinging a unit system.
1880  For example, a dimension style name "Millimters Small" would
1881  be assinged a unit system of millimeters.
1882  source_unit_system - [in]
1883  unit system in the model or file where the dimension
1884  style originated.
1885  destination_unit_system - [in]
1886  unit system in the model or file where the dimension
1887  style will be used.
1888  */
1889  void SetUnitSystemFromContext(
1890  bool bUseName,
1891  ON::LengthUnitSystem source_unit_system,
1892  ON::LengthUnitSystem destination_unit_system
1893  );
1894 
1895  /*
1896  Returns:
1897  true if the unit system is set to an explicit valid length unit.
1898  */
1899  bool UnitSystemIsSet() const;
1900 
1901  const ON_ScaleValue& ScaleValue() const;
1902  void SetDimScale(ON_ScaleValue sv);
1903  void SetDimScale(double left_val, ON::LengthUnitSystem left_us, double right_val, ON::LengthUnitSystem right_us);
1904 
1905  double ScaleLeftLength_mm() const;
1906  double ScaleRightLength_mm() const;
1907 
1908  void SetDimScale(double scale);
1909  double DimScale() const;
1910 
1911  void SetDimScaleSource(int source);
1912  int DimScaleSource() const; // 0: Global DimScale, 1: DimStyle DimScale
1913 
1914  void SetTextOrientation(ON::TextOrientation);
1915  ON::TextOrientation TextOrientation() const;
1916 
1917  void SetLeaderTextOrientation(ON::TextOrientation);
1918  ON::TextOrientation LeaderTextOrientation() const;
1919 
1920  void SetDimTextOrientation(ON::TextOrientation);
1921  ON::TextOrientation DimTextOrientation() const;
1922 
1923  void SetDimRadialTextOrientation(ON::TextOrientation);
1924  ON::TextOrientation DimRadialTextOrientation() const;
1925 
1926  ON_DimStyle::ContentAngleStyle DimTextAngleStyle() const;
1927  void SetDimTextAngleStyle(ON_DimStyle::ContentAngleStyle style);
1928 
1929  ON_DimStyle::ContentAngleStyle DimRadialTextAngleStyle() const;
1930  void SetDimRadialTextAngleStyle(ON_DimStyle::ContentAngleStyle style);
1931 
1932  bool TextUnderlined() const;
1933  void SetTextUnderlined(bool underlined);
1934 
1935  //double ModelSize() const;
1936  //void SetModelSize(double size);
1937  //double PaperSize() const;
1938  //void SetPaperSize(double size);
1939 
1940  // For converting to and from V5 Dimstyles
1941  static int V5ArrowType(ON_Arrowhead::arrow_type v6type);
1942  static int V5LengthFormat(ON_DimStyle::OBSOLETE_length_format v6format);
1943  static int V5AngleFormat(ON_DimStyle::angle_format v6format);
1944  static int V5ToleranceFormat(ON_DimStyle::tolerance_format v6format);
1945  static int V5MaskColorSourceFromV6MaskType(ON_TextMask::MaskType mask_type);
1946  static ON_Arrowhead::arrow_type V6ArrowType(int v5type);
1947  static ON_DimStyle::OBSOLETE_length_format V6LengthFormat(int v5format);
1948  static ON_DimStyle::angle_format V6AngleFormat(int v5format);
1949  static ON_DimStyle::tolerance_format V6ToleranceFormat(int v5format);
1950  static ON_TextMask::MaskType V6MaskTypeFromV5MaskColorSource(int v5_mask_color_source);
1951 
1952 private:
1953  double m_extextension = 0.5; // extension line extension
1954  double m_extoffset = 0.5; // extension line offset
1955  double m_arrowsize = 1.0; // length of an arrow - may mean different things to different arrows
1956  double m_leaderarrowsize = 1.0; // length of an arrow for leader style dimensions
1957  double m_centermark = 0.5; // size of the + at circle centers
1958  ON_DimStyle::centermark_style m_centermark_style = ON_DimStyle::centermark_style::Mark; // Display style for centermarks
1959  double m_textgap = 0.25; // gap around the text for clipping dim line
1960  double m_textheight = 1.0; // model unit height of dimension text before applying dimscale
1961 
1962  //ON::OBSOLETE_V5_TextDisplayMode m_REMOVE_ME_dimstyle_textalign = ON::OBSOLETE_V5_TextDisplayMode::kAboveLine;
1965 
1967  int m_angleresolution = 2; // for decimal degrees, digits past decimal
1968 
1969  /// <summary>
1970  /// The DimensionLengthDisplay is property controls the unit system and format
1971  /// of for display of lengths in dimensions. For more information, see the
1972  /// descriptions of the ON_DimStyle::LengthDisplay enum values.
1973  ///</summary>
1975 
1976  /// <summary>
1977  /// Alternate DimensionLengthDisplay property.
1978  /// See the description of m_dimension_length_display for more information about this property.
1979  ///</summary>
1980  ON_DimStyle::LengthDisplay m_alternate_dimension_length_display = ON_DimStyle::LengthDisplay::ModelUnits;
1981 
1982  /// <summary>
1983  /// The LengthResolution property controls the precision of dimension length display.
1984  ///
1985  /// DECIMAL LENGHT DISPLAY:
1986  /// If m_dimension_length_display is any of the ON_DimStyle::LengthDisplay decimal formats,
1987  /// then m_lengthresolution is the number of digits after the decimal point.
1988  /// For example, if m_lengthresolution is 2, then dimension length display will be n.ff
1989  /// If m_lengthresolution=7, then dimension length display will be n.fffffff.
1990  ///
1991  /// FRACTONAL LENGHT DISPLAY:
1992  /// If m_dimension_length_display is ON_DimStyle::LengthDisplay::InchesFractional or
1993  /// ON_DimStyle::LengthDisplay::FeetAndInches, then fractional length display is used.
1994  /// In this case any fractional part will be rouded to the closest multiple
1995  /// of 1/(2^m_alternate_lengthresolution).
1996  /// Examples: If fractional length display is used and m_lengthresolution=2,
1997  // then the possible fractions are 1/4, 1/2(=2/4), 3/4.
1998  /// If fractional length display is used and m_lengthresolution=7,
1999  // then any fractional part is rounded to the closest multipl of 1/128 (128=2^7).
2000  /// </summary>
2001  int m_lengthresolution = 2;
2002 
2003  /// <summary>
2004  /// Alternate LengthResolution property.
2005  /// See the description of m_lengthresolution for more information about this property.
2006  ///</summary>
2007  int m_alternate_lengthresolution = 2;
2008 
2009  /// <summary>
2010  /// The LengthFactor is property a rarely used. It applies when a model is being
2011  /// drawn to a scale and the dimension length values should be
2012  /// reverse scaled. For example, if a model is drawn at 1/4 scale,
2013  /// a line 5 units long indicates the real world line is 20 units
2014  /// long. In this case setting LengthFactor to 4 would cause
2015  /// a linear dimension applied to that line to display a value of 20.
2016  /// Use the DimensionLengthDisplay property to control length unit system scaling.
2017  ///</summary>
2018  double m_lengthfactor = 1.0; // (dimlfac) model units multiplier for length display
2019 
2020  /// <summary>
2021  /// Alternate LengthFactor property.
2022  /// See the description of m_lengthfactor for more information about this property.
2023  ///</summary>
2024  double m_alternate_lengthfactor = 1.0; // (dimaltf) model units multiplier for alternate length display
2025 
2026 
2027 private:
2028  // A copy of the font_characteristics passed to SetFont.
2029  // This information is saved in 3dm archives.
2030  ON_Font m_font_characteristics = ON_Font::Default;
2031 
2032  // The managed font returned by ON_Font::GetManagedFont(m_font).
2033  // This is the value returned by ON_DimStyle.Font().
2034  const ON_Font* m_managed_font = &ON_Font::Default;
2035 
2036 private:
2037  // all dim style content
2038  mutable ON_SHA1_Hash m_content_hash = ON_SHA1_Hash::EmptyContentHash;
2039 
2040  // text position properties content
2041  mutable ON_SHA1_Hash m_text_position_properties_hash = ON_SHA1_Hash::EmptyContentHash;
2042 
2043  mutable ON_SHA1_Hash m_reserved_hash2 = ON_SHA1_Hash::EmptyContentHash;
2044 
2045  // parent dim style content
2046  // All code should use ParentContentHash() to inspect this value.
2047  // Is is set by OverrideFields(). It may be cleared by a call to ParentContentHash().
2048  mutable ON_SHA1_Hash m_parent_dim_style_content_hash = ON_SHA1_Hash::EmptyContentHash;
2049 
2050 private:
2051 
2052 
2053  bool m_bAlternate = false; // (dimalt) display alternate dimension string (or not)
2054 
2055 
2056  ON_wString m_prefix; // string preceding dimension value string
2057  ON_wString m_suffix; // string following dimension value string
2058  ON_wString m_alternate_prefix; // string preceding alternate value string (Default = " [")
2059  ON_wString m_alternate_suffix; // string following alternate value string (Default = "]")
2060 
2061  double m_dimextension = 0.0; // (dimdle) dimension line extension past the "tip" location
2062 
2063  bool m_bSuppressExtension1 = false; // flag to not draw extension lines
2064  bool m_bSuppressExtension2 = false; // flag to not draw extension lines
2065  bool m_bReserved1 = false;
2066  bool m_bReserved2 = false;
2067 
2068  // m_field_override_count
2069  // number of ON_DimStyle::field settings that are independent of the parent dimension style.
2070  // (not inherited from)
2071  // A value of 0 indicates every possible setting is inherited from the parent dimension style.
2072  // A value > 0 indicates at least one setting is independent of the parent dimension style.
2073  ON__UINT32 m_field_override_parent_count = 0;
2074 
2075  // m_field_override_bitsN (Up to 128 true/false) values.
2076  // Each ON_DimStyle::field enum value > ON_DimStyle::field::Unset and < ON_DimStyle::field::Count
2077  // has a corresponding bit in on of the m_field_override_bitsN values.
2078  // When the bit is clear (0), the corresponding override parent setting value = false and
2079  // that setting is inheritied from the parent dimension style. 0 is the default setting.
2080  // When the bit is set (1), the corresponding override parent setting value = true and
2081  // that setting is independent of the parent dimension style.
2082  ON__UINT32 m_field_override_parent_bits0 = 0;
2083  ON__UINT32 m_field_override_parent_bits1 = 0;
2084  ON__UINT32 m_field_override_parent_bits2 = 0;
2085  ON__UINT32 m_field_override_parent_bits3 = 0;
2086  // Please do not replace this bitfield with an array of bools.
2087  // Using bools approach will change the size of this class when additional dimension style
2088  // settings are added and makes construction code more complicated.
2089 
2090 
2091  /*
2092  Parameters:
2093  mask - [out]
2094  0: field_id is not valid
2095  (Unset, Name, Index, >= Count)
2096  Name and Index settings cannot be inherited from the parent dimension style
2097  not 0:
2098  mask identifies the bit in the
2099  mask - [out]
2100  0: field_id is not valid
2101  (Unset, Name, Index, >= Count)
2102  Name and Index settings cannot be inherited from the parent dimension style
2103  not 0:
2104  mask identifies the bit in the
2105  Returns:
2106  nullptr:
2107  field_id is not valid
2108  (Unset, Name, Index, >= Count)
2109  Name and Index settings cannot be inherited from the parent dimension style.
2110  not nullptr:
2111  Address of the m_field_override_bitsN member that mask applies to.
2112  */
2113  ON__UINT32* Internal_GetOverrideParentBit(ON_DimStyle::field field_id, ON__UINT32* mask) const;
2114 
2116  int m_tolerance_resolution = 4;
2117  double m_tolerance_upper_value = 0.0; // or both upper and lower in symmetrical style
2118  double m_tolerance_lower_value = 0.0;
2119  double m_tolerance_height_scale = 0.7; // relative to the main dimension text
2120 
2121  double m_baseline_spacing = 3.0;
2122 
2123  ON_TextMask m_text_mask = ON_TextMask::None;
2124 
2125  // m_dimscale replaced by m_scale_value.RightToLeftScale()
2126  //double m_dimscale = 1.0;
2127  int m_dimscale_source = 0;
2128 
2129  // Uuid of source dimstyle to restore defaults
2130  ON_UUID m_source_dimstyle = ON_nil_uuid;
2131 
2132  // Sub-object draw colors
2133  unsigned char m_ext_line_color_source = 0;
2134  unsigned char m_dim_line_color_source = 0;
2135  unsigned char m_arrow_color_source = 0;
2136  unsigned char m_text_color_source = 0;
2137  ON_Color m_ext_line_color = ON_Color::Black;
2138  ON_Color m_dim_line_color = ON_Color::Black;
2139  ON_Color m_arrow_color = ON_Color::Black;
2140  ON_Color m_text_color = ON_Color::Black;
2141  unsigned char m_ext_line_plot_color_source = 0;
2142  unsigned char m_dim_line_plot_color_source = 0;
2143  unsigned char m_arrow_plot_color_source = 0;
2144  unsigned char m_text_plot_color_source = 0;
2145  ON_Color m_ext_line_plot_color = ON_Color::Black;
2146  ON_Color m_dim_line_plot_color = ON_Color::Black;
2147  ON_Color m_arrow_plot_color = ON_Color::Black;
2148  ON_Color m_text_plot_color = ON_Color::Black;
2149  unsigned char m_ext_line_plot_weight_source = 0;
2150  unsigned char m_dim_line_plot_weight_source = 0;
2151  double m_ext_line_plot_weight_mm = 0.0;
2152  double m_dim_line_plot_weight_mm = 0.0;
2153 
2154  double m_fixed_extension_len = 1.0; // Fixed extension line length if m_fixed_extension_len_on is true
2155  bool m_fixed_extension_len_on = false; // true: use fixed_extension_len, false: don't use m_fixed_extension_len
2156 
2157  double m_text_rotation = 0.0; // Dimension text rotation around text point (radians)
2158  int m_alternate_tolerance_resolution = 4; // for decimal, digits past the decimal point, fractions: 1/2^n
2159  double m_tol_textheight_fraction = 0.6; // fraction of main text height
2160 
2161  bool m_suppress_arrow1 = false; // false: dont suppress, true: suppress
2162  bool m_suppress_arrow2 = false; // false: dont suppress, true: suppress
2163  int m_textmove_leader = 0; // 0: move text anywhere, 1: add leader when moving text
2164  int m_arclength_sym = 0; // 0: symbol before dim text, 1: symbol above dim text, no symbol
2165  double m_stack_textheight_fraction = 0.7; // fraction of main text height
2167  double m_alt_round = 0.0; // rounds to nearest specified value
2168  double m_round = 0.0;
2169  double m_angular_round = 0.0;
2170 
2173 
2175 
2176  bool m_alt_below = false; // true: display alternate text below main text
2177  // false: display alternate text after main text
2178  ON_Arrowhead::arrow_type m_arrow_type_1 = ON_Arrowhead::arrow_type::SolidTriangle; // Arrow types for ON_Dimension derived dimensions
2181  ON_UUID m_arrow_block_id_1 = ON_nil_uuid;
2182  ON_UUID m_arrow_block_id_2 = ON_nil_uuid;
2183  ON_UUID m_leader_arrow_block_id = ON_nil_uuid;
2184 
2185  // Text
2186  ON::TextVerticalAlignment m_text_vertical_alignment = ON::TextVerticalAlignment::Top;
2187  ON::TextHorizontalAlignment m_text_horizontal_alignment = ON::TextHorizontalAlignment::Left;
2188 
2189  // Leader
2190  ON::TextVerticalAlignment m_leader_text_vertical_alignment = ON::TextVerticalAlignment::Middle;
2191  ON::TextHorizontalAlignment m_leader_text_horizontal_alignment = ON::TextHorizontalAlignment::Left;
2192 
2195  double m_leader_content_angle = 0.0;
2196  bool m_leader_has_landing = true;
2197  double m_leader_landing_length = 1.0;
2198 
2199  bool m_draw_forward = true;
2200  bool m_signed_ordinate = true;
2201  ON_ScaleValue m_scale_value = ON_ScaleValue::OneToOne;
2202 
2203  // Unit system for dimension rendering sizes like text height, and arrow head length.
2204  // m_textheight, m_textgap, m_arrowsize, m_extoffset, and dozens of other properties
2205  // that control the appearance and placement of the components used to render
2206  // a dimension.
2207  ON::LengthUnitSystem m_unitsystem = ON::LengthUnitSystem::None;
2208 
2209  ON::TextOrientation m_text_orientation = ON::TextOrientation::InPlane;
2210  ON::TextOrientation m_leader_text_orientation = ON::TextOrientation::InPlane;
2211  ON::TextOrientation m_dim_text_orientation = ON::TextOrientation::InPlane;
2212  ON::TextOrientation m_dimradial_text_orientation = ON::TextOrientation::InPlane;
2213 
2216 
2217  bool m_text_underlined = false; // extra/extended line under text block in leaders and radial dimensions
2218 
2219 private:
2220  ON__UINT_PTR m_reserved = 0;
2221 
2222 private:
2223  void Internal_ContentChange() const;
2224 };
2225 
2226 
2227 /*
2228 Description:
2229  A general and portable interface to access a model's available dimension styles.
2230 Remarks:
2231  The Rhino C++ SDK function CRhinoDoc.DimStyleContext() will return an ON_DimStyleContext for the Rhino model.
2232  The ONX_Model function ONX_Model.DimStyleContext() will return an ON_DimStyleContext for ONX_Model model.
2233 */
2234 class ON_CLASS ON_DimStyleContext
2235 {
2236 public:
2237  ON_DimStyleContext() = default;
2238  virtual ~ON_DimStyleContext();
2239  ON_DimStyleContext(const ON_DimStyleContext&) = default;
2240  ON_DimStyleContext& operator=(const ON_DimStyleContext&) = default;
2241 
2242 public:
2243  virtual const ON_DimStyle& CurrentDimStyle() const;
2244 
2245  virtual const ON_DimStyle* DimStyleFromId(
2246  ON_UUID id,
2247  const ON_DimStyle* not_found_result = nullptr
2248  ) const;
2249 
2250  virtual const ON_DimStyle* DimStyleFromName(
2251  const ON_NameHash& name_hash,
2252  const ON_DimStyle* not_found_result = nullptr
2253  ) const;
2254 
2255  virtual const ON_DimStyle* DimStyleFromContentHash(
2256  const ON_SHA1_Hash& content_hash,
2257  const ON_DimStyle* not_found_result = nullptr
2258  ) const;
2259 
2260  virtual const ON_DimStyle* DimStyleFromFont(
2261  const ON_Font& font,
2262  double model_space_text_scale,
2263  double text_height,
2264  ON::LengthUnitSystem text_height_unit_system,
2265  bool bReturnClosestMatch = true,
2266  const ON_DimStyle* not_found_result = nullptr
2267  ) const;
2268 
2269  virtual bool AddDimStyle(
2270  const ON_DimStyle& dim_style,
2271  bool bResolveNameAndIdConflicts
2272  );
2273 
2274  virtual bool ModifyDimStyle(
2275  ON_UUID model_dim_style_id,
2276  const ON_DimStyle& dim_style
2277  );
2278 
2279  virtual const ON_DimStyle* FirstDimStyle(
2280  bool bIncludeSystemDimStyles = false,
2281  bool bIncludeDeletedDimStyles = false
2282  ) const;
2283 
2284  virtual const ON_DimStyle* NextDimStyle(
2285  ON_UUID id,
2286  bool bIncludeSystemDimStyles = false,
2287  bool bIncludeDeletedDimStyles = false
2288  ) const;
2289 
2290  virtual const ON_DimStyle* PrevDimStyle(
2291  ON_UUID id,
2292  bool bIncludeSystemDimStyles = false,
2293  bool bIncludeDeletedDimStyles = false
2294  ) const;
2295 
2296  virtual ON::LengthUnitSystem ModelUnitSystem() const;
2297 
2298  virtual ON__UINT64 ModelSerialNumber() const;
2299 
2300 protected:
2301  mutable ON::LengthUnitSystem m_unit_system = ON::LengthUnitSystem::Millimeters;
2302  mutable ON__UINT64 m_model_serial_number = 0;
2303 };
2304 
2305 
2306 #if defined(ON_DLL_TEMPLATE)
2307 ON_DLL_TEMPLATE template class ON_CLASS ON_SimpleArray<ON_DimStyle*>;
2308 ON_DLL_TEMPLATE template class ON_CLASS ON_ObjectArray<ON_DimStyle>;
2309 #endif
2310 
2311 #endif
static ON_DimStyle * CreateFromFont(const ON_Font *font_characteristics, double model_space_text_scale, const ON_DimStyle *dimstyle_settings, const class ON_ComponentManifest *manifest, ON_DimStyle *destination)
Create a clean dimension style that has the specified font. With the exception of the name...
suppress_zero
Marks leading and trailing zeros for removal.
Definition: opennurbs_dimensionstyle.h:950
angle_format
Display format for angles
Definition: opennurbs_dimensionstyle.h:860
ON_UUID is a 16 byte universally unique identifier.
Definition: opennurbs_uuid.h:32
static const ON_ScaleValue OneToOne
Definition: opennurbs_string_value.h:436
centermark_style
Style for drawing centermark for Radial dimensions and Centermark objects
Definition: opennurbs_dimensionstyle.h:996
static const ON_SHA1_Hash EmptyContentHash
Definition: opennurbs_sha1.h:23
arrow_type
Defines enumerated values for arrowhead shapes.
Definition: opennurbs_dimensionstyle.h:37
Aligned with last leader direction or dimension line
The ON_ModelComponent class is a base class for all components in a model and manages the index...
Definition: opennurbs_model_component.h:24
field
Field identifiers used for file i/o and getting/setting values
Definition: opennurbs_dimensionstyle.h:584
Definition: opennurbs_dimensionstyle.h:21
ON_DimStyle & operator=(const ON_DimStyle &)=default
static const class ON_DimStyle & DimStyleOrDefault(const class ON_DimStyle *dimstyle)
static const ON_DimStyle * FromModelComponentRef(const class ON_ModelComponentReference &model_component_reference, const ON_DimStyle *none_return_value)
Definition: opennurbs_array.h:36
Text mask drawn with background color
Definition: opennurbs_sha1.h:19
Definition: opennurbs_dimensionstyle.h:1337
stack_format
Format of stacked fractions
Definition: opennurbs_dimensionstyle.h:977
void EmergencyDestroy()
Interface.
LengthDisplay
Interface.
Definition: opennurbs_dimensionstyle.h:426
ON_Object array is used to store lists of classes that are derived from ON_Object. It differs from ON_ClassArray in that the virtual ON_Object::MemoryRelocate function is called when growing the dynamic array requires changing the location of the memory buffer used to store the elements in the array.
Definition: opennurbs_array.h:725
Definition: opennurbs_string.h:2020
Definition: opennurbs_dimensionstyle.h:218
TextLocation
The location of text in linear, angular, radial, and ordinate dimensions.
Definition: opennurbs_dimensionstyle.h:920
Definition: opennurbs_color.h:24
Text is above dimension line.
bool IsValid(class ON_TextLog *text_log=nullptr) const override
virtual
static const ON_DimStyle & SystemDimstyleFromIndex(int index)
MaskType
Text mask drawn with background color or explicit color
Definition: opennurbs_dimensionstyle.h:103
Definition: opennurbs_3dm_settings.h:110
Definition: opennurbs_dimensionstyle.h:95
bool Read(ON_BinaryArchive &) override
virtual
void Dump(ON_TextLog &) const override
virtual
static const ON_TextMask None
ON_TextMask::None has no effect on text appearance.
Definition: opennurbs_dimensionstyle.h:131
Text is centered in dimension line.
Definition: opennurbs_bounding_box.h:25
static const ON_DimStyle & SystemDimstyleFromId(ON_UUID id)
Decimal current model units
Definition: opennurbs_xform.h:28
A general and portable interface to access a model&#39;s available dimension styles.
Definition: opennurbs_dimensionstyle.h:2193
An ON_Font is a face in a font family. It corresponds to a Windows LOGFONT, a .NET System...
Definition: opennurbs_font.h:225
Definition: opennurbs_archive.h:478
static const ON_Color White
Definition: opennurbs_color.h:34
OBSOLETE_length_format
Obsolete format for length display - use ON_DimStyle::DimensionLengthDisplay instead ...
Definition: opennurbs_dimensionstyle.h:881
friend class ON_V5x_DimStyle
Definition: opennurbs_dimensionstyle.h:222
An ON_NameHash is designed to help search for and compare attribute names like the ON_ModelComponent...
Definition: opennurbs_string.h:3434
tolerance_format
Style of tolerance display for dimensions
Definition: opennurbs_dimensionstyle.h:503
bool CompareFields(const ON_DimStyle &src) const
Annotation text is horizontal in annotation object&#39;s plane
Definition: opennurbs_string_value.h:427
Definition: opennurbs_textlog.h:20
Definition: opennurbs_archive.h:1783
leader_curve_type
Type of leader curve
Definition: opennurbs_dimensionstyle.h:558
ON_DimStyle()
Default constructor result is identical to ON_DimStyle::Unset;.
Definition: opennurbs_model_component.h:1622
ContentAngleStyle
Angle for text or other leader or dimension content
Definition: opennurbs_dimensionstyle.h:533
static const ON_DimStyle & SystemDimstyleFromName(const ON_NameHash &name_hash)
static const ON_Font Default
Definition: opennurbs_font.h:502
bool Write(ON_BinaryArchive &) const override
virtual
static const ON_SHA1_Hash ZeroDigest
Definition: opennurbs_sha1.h:22
const ON_wString * s_val
Definition: opennurbs_dimensionstyle.h:1369
static const ON_DimStyle & SystemDimstyleFromContentHash(const ON_SHA1_Hash &content_hash)
static const ON_Color Black
Definition: opennurbs_color.h:33
~ON_DimStyle()=default
bool CompareDimstyle(const ON_DimStyle &src) const
Definition: opennurbs_point.h:1973