opennurbs_internal_V5_annotation.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 #ifndef OPENNURBS_INTERNAL_V5_ANNOTATION_H_INC
18 #define OPENNURBS_INTERNAL_V5_ANNOTATION_H_INC
19 
20 #if defined(ON_COMPILING_OPENNURBS)
21 // V5 annotation classes are internal to opennurbs and are used exclusively
22 // to support reading and writing V5 3dm archives.
23 
24 #if defined(ON_OS_WINDOWS_GDI)
25 #define ON_OBSOLETE_V5_RECT RECT
26 #else
27 typedef struct tagON_RECT
28 {
29  int left;
30  int top;
31  int right;
32  int bottom;
33 } ON_OBSOLETE_V5_RECT;
34 #endif
35 
36 class ON_OBSOLETE_V5_AnnotationText : public ON_wString
37 {
38 public:
39  ON_OBSOLETE_V5_AnnotationText();
40  ~ON_OBSOLETE_V5_AnnotationText();
41 
42 
43  ON_OBSOLETE_V5_AnnotationText& operator=(const char*);
44  ON_OBSOLETE_V5_AnnotationText& operator=(const wchar_t*);
45 
46  void SetText( const char* s );
47  void SetText( const wchar_t* s );
48 
49  // m_rect is a Windows gdi RECT that bounds text
50  // ("x" increases to the right and "y" increases downwards).
51  // If all fields are 0, then m_rect is not set.
52  // If left < right and top < bottom, then the rect bounds
53  // the text when it is drawn with its font's
54  // lfHeight=ON_Font::Constants::AnnotationFontCellHeight and (0,0) left baseline
55  // point of the leftmost character on the first line
56  // of text. If (x,y) is a point on the drawn text, then
57  // left <= x < right and top <= y < bottom.
58  ON_OBSOLETE_V5_RECT m_rect;
59 };
60 
61 // Extension to ON_OBSOLETE_V2_TextObject added 12/10/2009 for Text background drawing
62 class ON_OBSOLETE_V5_TextExtra : public ON_UserData
63 {
64  ON_OBJECT_DECLARE(ON_OBSOLETE_V5_TextExtra);
65 public:
66 
67  ON_OBSOLETE_V5_TextExtra();
68  ~ON_OBSOLETE_V5_TextExtra();
69 
70  static
71  ON_OBSOLETE_V5_TextExtra* TextExtension(class ON_OBSOLETE_V5_TextObject* pDim, bool bCreate);
72  static const
73  ON_OBSOLETE_V5_TextExtra* TextExtension(const class ON_OBSOLETE_V5_TextObject* pDim, bool bCreate);
74 
75  void SetDefaults();
76 
77  // override virtual ON_Object::Dump function
78  void Dump( ON_TextLog& text_log ) const override;
79 
80  // override virtual ON_Object::Dump function
81  unsigned int SizeOf() const override;
82 
83  // override virtual ON_Object::Write function
84  bool Write(ON_BinaryArchive& binary_archive) const override;
85 
86  // override virtual ON_Object::Read function
87  bool Read(ON_BinaryArchive& binary_archive) override;
88 
89  // override virtual ON_UserData::GetDescription function
90  bool GetDescription( ON_wString& description ) override;
91 
92  // override virtual ON_UserData::Archive function
93  bool Archive() const override;
94 
95  ON_UUID ParentUUID() const;
96  void SetParentUUID( ON_UUID parent_uuid);
97 
98  bool DrawTextMask() const;
99  void SetDrawTextMask(bool bDraw);
100 
101  int MaskColorSource() const;
102  void SetMaskColorSource(int source);
103 
104  ON_Color MaskColor() const; // Only works right if MaskColorSource returns 2.
105  // Does not return viewport background color
106  void SetMaskColor(ON_Color color);
107 
108  double MaskOffsetFactor() const;
109  void SetMaskOffsetFactor(double offset);
110 
111  ON_UUID m_parent_uuid; // uuid of the text using this extension
112 
113  bool m_bDrawMask; // do or don't draw a mask
114 
115  int m_color_source; // 0: Use background color from viewport
116  // 1: Use specific color from m_mask_color
117 
118  ON_Color m_mask_color; // Color to use for mask if m_color_source is 2
119 
120  double m_border_offset; // Offset for the border around text to the rectangle used to draw the mask
121  // This number * HeightOfI for the text is the offset on each side of the
122  // tight rectangle around the text characters to the mask rectangle.
123 };
124 
125 
126 class ON_OBSOLETE_V5_DimExtra : public ON_UserData
127 {
128  ON_OBJECT_DECLARE(ON_OBSOLETE_V5_DimExtra);
129 public:
130 
131  ON_OBSOLETE_V5_DimExtra();
132  ~ON_OBSOLETE_V5_DimExtra();
133 
134  static
135  ON_OBSOLETE_V5_DimExtra* DimensionExtension(class ON_OBSOLETE_V5_DimLinear* pDim, bool bCreate);
136  static const
137  ON_OBSOLETE_V5_DimExtra* DimensionExtension(const class ON_OBSOLETE_V5_DimLinear* pDim, bool bCreate);
138  static
139  ON_OBSOLETE_V5_DimExtra* DimensionExtension(class ON_OBSOLETE_V5_DimRadial* pDim, bool bCreate);
140  static const
141  ON_OBSOLETE_V5_DimExtra* DimensionExtension(const class ON_OBSOLETE_V5_DimRadial* pDim, bool bCreate);
142  static
143  ON_OBSOLETE_V5_DimExtra* DimensionExtension(class ON_OBSOLETE_V5_DimOrdinate* pDim, bool bCreate);
144  static const
145  ON_OBSOLETE_V5_DimExtra* DimensionExtension(const class ON_OBSOLETE_V5_DimOrdinate* pDim, bool bCreate);
146 
147  void SetDefaults();
148 
149  // override virtual ON_Object::Dump function
150  void Dump( ON_TextLog& text_log ) const override;
151 
152  // override virtual ON_Object::Dump function
153  unsigned int SizeOf() const override;
154 
155  // override virtual ON_Object::Write function
156  bool Write(ON_BinaryArchive& binary_archive) const override;
157 
158  // override virtual ON_Object::Read function
159  bool Read(ON_BinaryArchive& binary_archive) override;
160 
161  // override virtual ON_UserData::GetDescription function
162  bool GetDescription( ON_wString& description ) override;
163 
164  // override virtual ON_UserData::Archive function
165  bool Archive() const override;
166 
167  ON_UUID ParentUUID() const;
168  void SetParentUUID( ON_UUID parent_uuid);
169 
170  // 0: default position
171  // 1: force inside
172  // -1: force outside
173  int ArrowPosition() const;
174  void SetArrowPosition( int position);
175 
176  // For a dimension in page space that measures between points in model space
177  // of a detail view, this is the ratio of the page distance / model distance.
178  // When the dimension text is displayed, the distance measured in model space
179  // is multiplied by this number to get the value to display.
180  double DistanceScale() const;
181  void SetDistanceScale(double s);
182 
183  // Basepont in modelspace coordinates for ordinate dimensions
184  void SetModelSpaceBasePoint(ON_3dPoint basepoint);
185  ON_3dPoint ModelSpaceBasePoint() const;
186 
187  // If this dimension measures objects in the model space of a detail view
188  // this is the detail view, otherwise, nil_uuid
189  ON_UUID DetailMeasured() const;
190  void SetDetailMeasured(ON_UUID detail_id);
191 
192  //const wchar_t* ToleranceUpperString() const;
193  //ON_wString& ToleranceUpperString();
194  //void SetToleranceUpperString( const wchar_t* upper_string);
195  //void SetToleranceUpperString( ON_wString& upper_string);
196 
197  //const wchar_t* ToleranceLowerString() const;
198  //ON_wString& ToleranceLowerString();
199  //void SetToleranceLowerString( const wchar_t* lower_string);
200  //void SetToleranceLowerString( ON_wString& lower_string);
201 
202  //const wchar_t* AlternateString() const;
203  //ON_wString& AlternateString();
204  //void SetAlternateString( const wchar_t* alt_string);
205  //void SetAlternateString( ON_wString& alt_string);
206 
207  //const wchar_t* AlternateToleranceUpperString() const;
208  //ON_wString& AlternateToleranceUpperString();
209  //void SetAlternateToleranceUpperString( const wchar_t* upper_string);
210  //void SetAlternateToleranceUpperString( ON_wString& upper_string);
211 
212  //const wchar_t* AlternateToleranceLowerString() const;
213  //ON_wString& AlternateToleranceLowerString();
214  //void SetAlternateToleranceLowerString( const wchar_t* lower_string);
215  //void SetAlternateToleranceLowerString( ON_wString& lower_string);
216 
217  ON_UUID m_partent_uuid; // the dimension using this extension
218 
219  int m_arrow_position;
220 
221  // This is either nullptr or an array of GDI rects for the substrings
222  // that make up the dimension string.
223  // If the dimension text is all on the same line, there is just one
224  // rectangle needed to bound the text and that is the same as the
225  // m_rect on the ON_OBSOLETE_V5_AnnotationText.
226  // If the dimension has tolerances or for some other reason has more
227  // than one line of text, m_text_rects is an array of 7 rects, one
228  // each for the substrings that might be needed to display the dimension.
229  // If some of the rects aren't used, they are empty at 0,0
230  // The strings that correspond to these rectangles are generated from
231  // info in the dimstyle
232  ON_OBSOLETE_V5_RECT* m_text_rects;
233 
234  double m_distance_scale;
235  ON_3dPoint m_modelspace_basepoint;
236 
237  // If this dimension measures objects in the model space of a detail view
238  // this is the detail view
239  // 27 Aug, 2014, v6
240  ON_UUID m_detail_measured;
241 };
242 
243 
244 /*
245  class ON_OBSOLETE_V5_Annotation
246 
247  Description:
248  Used to serialize definitions of annotation objects (dimensions, text, leaders, etc.).
249  Virtual base class for annotation objects
250  Replaces ON_OBSOLETE_V2_Annotation
251 */
252 class ON_OBSOLETE_V5_Annotation : public ON_Geometry
253 {
254  ON_OBJECT_DECLARE(ON_OBSOLETE_V5_Annotation);
255 
256 protected:
257  ON_OBSOLETE_V5_Annotation();
258  ON_OBSOLETE_V5_Annotation(const ON_OBSOLETE_V5_Annotation&) = default;
259  ON_OBSOLETE_V5_Annotation& operator=(const ON_OBSOLETE_V5_Annotation&) = default;
260 
261 public:
262  virtual ~ON_OBSOLETE_V5_Annotation();
263 
264 protected:
265  void Internal_InitializeFromV2Annotation(
266  const class ON_OBSOLETE_V2_Annotation& V2_annotation,
267  const class ON_3dmAnnotationContext* annotation_context
268  );
269 
270 public:
271  static ON_OBSOLETE_V5_Annotation* CreateFromV2Annotation(
272  const class ON_OBSOLETE_V2_Annotation& V2_annotation,
273  const class ON_3dmAnnotationContext* annotation_context
274  );
275 
276 public:
277  static ON_OBSOLETE_V5_Annotation* CreateFromV6Annotation(
278  const class ON_Annotation& V6_annotation,
279  const class ON_3dmAnnotationContext* annotation_context
280  );
281 
282 protected:
283  ////void Internal_SetDimStyleFromV6Annotation(
284  //// const class ON_Annotation& V6_annotation,
285  //// const class ON_3dmAnnotationContext* annotation_context
286  ////);
287 
288 public:
289 
290  // Description:
291  // Sets initial defaults
292  void Create();
293 
294  void Destroy();
295 
296  void EmergencyDestroy();
297 
298  /////////////////////////////////////////////////////////////////
299  //
300  // ON_Object overrides
301  //
302 
303  bool IsValid( class ON_TextLog* text_log = nullptr ) const override;
304 
305 
306  /*
307  Description: Writes the object to a file
308 
309  Returns:
310  @untitled Table
311  true Success
312  false Failure
313  */
314  bool Write(
316  ) const override;
317 
318  /*
319  Description: Reads the object from a file
320 
321  Returns:
322  @untitled Table
323  true Success
324  false Failure
325  */
326  bool Read(
328  ) override;
329 
330  /*
331  Returns: The Object Type of this object
332  */
333  ON::object_type ObjectType() const override;
334 
335  /////////////////////////////////////////////////////////////////
336  //
337  // ON_Geometry overrides
338  //
339 
340  /*
341  Returns the geometric dimension of the object ( usually 3)
342  */
343  int Dimension() const override;
344 
345  // overrides virtual ON_Geometry::Transform()
346  bool Transform( const ON_Xform& xform ) override;
347 
348  // virtual ON_Geometry override
349  bool EvaluatePoint( const class ON_ObjRef& objref, ON_3dPoint& P ) const override;
350 
351  /////////////////////////////////////////////////////////////////
352  //
353  // ON_OBSOLETE_V5_Annotation interface
354  //
355 
356  // Definitions of text justification
357  // Not implemented on all annotation objects
358  enum eTextJustification
359  {
360  tjUndefined = 0,
361  tjLeft = 1<<0,
362  tjCenter = 1<<1,
363  tjRight = 1<<2,
364  tjBottom = 1<<16,
365  tjMiddle = 1<<17,
366  tjTop = 1<<18,
367  tjBottomLeft = tjBottom | tjLeft,
368  tjBottomCenter = tjBottom | tjCenter,
369  tjBottomRight = tjBottom | tjRight,
370  tjMiddleLeft = tjMiddle | tjLeft,
371  tjMiddleCenter = tjMiddle | tjCenter,
372  tjMiddleRight = tjMiddle | tjRight,
373  tjTopLeft = tjTop | tjLeft,
374  tjTopCenter = tjTop | tjCenter,
375  tjTopRight = tjTop | tjRight,
376  };
377 
378  /*
379  Description:
380  Query if the annotation object is a text object
381  Parameters:
382  none
383  Returns:
384  @untitled table
385  true It is text
386  false Its not text
387  */
388  bool IsText() const;
389 
390  /*
391  Description:
392  Query if the annotation object is a leader
393  Parameters:
394  none
395  Returns:
396  @untitled table
397  true It is a leader
398  false Its not a leader
399  */
400  bool IsLeader() const;
401 
402  /*
403  Description:
404  Query if the annotation object is a dimension
405  Parameters:
406  none
407  Returns:
408  @untitled table
409  true It is a dimension
410  false Its not a dimension
411  */
412  bool IsDimension() const;
413 
414 public:
415  int V5_3dmArchiveDimStyleIndex() const;
416 
417  /*
418  Description:
419  If IsText() is false, the dimension style is set.
420  */
421  void SetV5_3dmArchiveDimStyleIndex(
422  int V5_dim_style_index
423  );
424 
425  ////ON_UUID V6_DimStyleId() const;
426 
427 
428 
429  /////*
430  ////Description:
431  //// If IsText() is false, the dimension style is set.
432  ////*/
433  ////void SetV6_DimStyleId(
434  //// ON_UUID dim_style_id,
435  //// int V5_dim_style_index
436  //// );
437 
438  ////const ON_DimStyle* V6_DimStyleOverride() const;
439 
440  /////*
441  ////Description:
442  //// If IsText() is false, the dimension style is set.
443  ////*/
444  ////void SetV6_DimStyleOverride(
445  //// const ON_DimStyle* dim_style_override,
446  //// int V5_dim_style_index
447  //// );
448 
449 public:
450 
451  /*
452  Returns:
453  Dimension type
454  Linear dim: distance between arrow tips
455  Radial dim: radius or diameter depending on m_type value
456  Angular dim: angle in degrees
457  Leader: ON_UNSET_VALUE
458  Text: ON_UNSET_VALUE
459  */
460  virtual
461  double NumericValue() const;
462 
463  /*
464  Description:
465  Set or Get the height of the text in this annotation
466  Parameters:
467  [in] double new text height to set
468  Returns:
469  double Height of the text
470  Remarks:
471  Height is in model units
472  */
473  void SetHeight( double);
474  double Height() const;
475 
476  /*
477  Description:
478  Sets or gets the object type member to a specific annotation type:
479  dtDimLinear, dtDimAligned, dtDimAngular, etc.
480  Parameters:
481  [in] ON_INTERNAL_OBSOLETE::V5_eAnnotationType type - dtDimLinear, dtDimAligned, dtDimAngular, etc.
482  Returns:
483  ON_INTERNAL_OBSOLETE::V5_eAnnotationType of the object
484  */
485  void SetType( ON_INTERNAL_OBSOLETE::V5_eAnnotationType);
486  ON_INTERNAL_OBSOLETE::V5_eAnnotationType Type() const;
487 
488  /*
489  Description:
490  Set or get the plane for the object's ECS
491  Parameters:
492  [in] ON_Plane& plane in WCS
493  Returns:
494  const ON_Plane& - the object's ECS plane in WCS coords
495  */
496  void SetPlane( const ON_Plane&);
497  const ON_Plane& Plane() const;
498 
499  /*
500  Description:
501  Returns the number of definition points this object has
502  Parameters:
503  none
504  Returns:
505  @untitled table
506  int the object's point count
507  */
508  int PointCount() const;
509  void SetPointCount( int count);
510 
511  /*
512  Description:
513  Set or get the object's whole points array at once
514  Parameters:
515  [in] ON_2dPointArray& pts
516  Returns:
517  const ON_2dPointArray& - ref to the object's point array
518  */
519  void SetPoints( const ON_2dPointArray&);
520  const ON_2dPointArray& Points() const;
521 
522  /*
523  Description:
524  Set individual definition points for the annotation
525  Parameters:
526  @untitled table
527  [in] int index index of the point to set in ECS 2d coordinates
528  [in] const ON_2dPoint& pt the new point value
529  Returns:
530  ON_2dPoint the point coordinates in ECS
531  */
532  void SetPoint( int, const ON_2dPoint&);
533  ON_2dPoint Point( int) const;
534 
535  /*
536  Description:
537 
538  Set or get the string value of the user text, with no substitution for "<>"
539  Parameters:
540  [in] const wchar_t* string the new value for UserText
541  Returns:
542  const ON_wString& The object's UserText
543  Remarks:
544  UserText is the string that gets printed when the dimensoin is drawn.
545  If it contains the token "<>", that token is replaced with the measured
546  value for the dimension, formatted according to the DimStyle settings.
547  "<>" is the default for linear dimensions.
548  Other dimensions include "<>" in their default string
549  */
550 
551  ON_DEPRECATED_MSG("use SetTextValue function")
552  void SetUserText( const wchar_t* text_value );
553 
554  ON_DEPRECATED_MSG("use TextValue function")
555  const ON_wString& UserText() const;
556 
557 
558  /*
559  Description:
560  Gets the value of the annotation text.
561  Returns:
562  Value of the annotation text.
563  See Also:
564  ON_OBSOLETE_V5_AnnotationText::SetTextValue()
565  ON_OBSOLETE_V5_AnnotationText::SetTextFormula()
566  ON_OBSOLETE_V5_AnnotationText::TextFormula()
567  Remarks:
568  This gets the literal value of the text, there is no
569  substitution for any "<>" substrings. When a dimension
570  is drawn, any occurance of "<>" will be replaced
571  with the measured value for the dimension and formatted
572  according to the DimStyle settings.
573 
574  Annotation text values can be constant or the result
575  of evaluating text formula containing %<...>%
576  expressions. The ...TextValue() functions set
577  and get the text's value. The ...TextFormula()
578  functions get and set the text's formula.
579  */
580  const wchar_t* TextValue() const;
581 
582  /*
583  Description:
584  Sets the value of the annotation text. No changes
585  are made to the text_value string.
586  Parameters:
587  text_value - [in]
588  Returns:
589  Value of the annotation text.
590  See Also:
591  ON_OBSOLETE_V5_AnnotationText::SetTextFormula()
592  ON_OBSOLETE_V5_AnnotationText::TextValue()
593  ON_OBSOLETE_V5_AnnotationText::TextFormula()
594  Remarks:
595  Annotation text values can be constant or the result
596  of evaluating text formula containing %<...>%
597  expressions. The ...TextValue() functions set
598  and get the text's value. The ...TextFormula()
599  functions get and set the text's formula.
600  */
601  void SetTextValue( const wchar_t* text_value );
602 
603  /*
604  Description:
605  Gets the formula for the annotation text.
606  Parameters:
607  text_value - [in]
608  Returns:
609  Value of the annotation text.
610  See Also:
611  ON_OBSOLETE_V5_AnnotationText::SetTextValue()
612  ON_OBSOLETE_V5_AnnotationText::TextValue()
613  ON_OBSOLETE_V5_AnnotationText::TextFormula()
614  Remarks:
615  Annotation text values can be constant or the result
616  of evaluating text formula containing %<...>%
617  expressions. The ...TextValue() functions set
618  and get the text's value. The ...TextFormula()
619  functions get and set the text's formula.
620  */
621  const wchar_t* TextFormula() const;
622 
623  /*
624  Description:
625  Sets the formula for the annotation text.
626  Parameters:
627  text_value - [in]
628  Returns:
629  Value of the annotation text.
630  See Also:
631  ON_OBSOLETE_V5_AnnotationText::SetTextValue()
632  ON_OBSOLETE_V5_AnnotationText::Value()
633  ON_OBSOLETE_V5_AnnotationText::Formula()
634  Remarks:
635  Annotation text values can be constant or the result
636  of evaluating text formula containing %<...>%
637  expressions. The ...TextValue() functions set
638  and get the text's value. The ...TextFormula()
639  functions get and set the text's formula.
640  */
641  void SetTextFormula( const wchar_t* s );
642 
643  /*
644  Description:
645  Set or get a flag indication that the dimension text has been moved
646  from the default location.
647  Parameters:
648  bUserPositionedText - [in]
649  true to indicate that the text has been placed by the user.
650  false to indicate that it hasn't
651  Returns:
652  @untitled table
653  true The text has been moved
654  false The text is in the default location
655  Remarks:
656  If the text is in the default location, it should be repositioned
657  automatically when the dimension is adjusted.
658  If it has been moved, it should not be automatically positioned.
659  */
660  void SetUserPositionedText( int bUserPositionedText );
661  bool UserPositionedText() const;
662 
663  /*
664  Description:
665  Set or get the text display mode for the annotation
666  Parameters:
667  [in] ON::eTextDisplayMode mode - new mode to set
668  Returns:
669  ON::eTextDisplayMode - current mode
670  Remarks:
671  This is the way the text is oriented with respect to the dimension line or screen:
672  Above line, In LIne, Horizontal
673  */
674  void SetTextDisplayMode( ON_INTERNAL_OBSOLETE::V5_TextDisplayMode);
675  ON_INTERNAL_OBSOLETE::V5_TextDisplayMode TextDisplayMode() const;
676 
677 
678  /*
679  Description:
680  Gets a transform matrix to change from the object's 2d ECS to 3d WCS
681  Parameters:
682  [out] xform set to produce the ECS to WCS transform
683  Returns:
684  @untitled table
685  true Success
686  false Failure
687  */
688  bool GetECStoWCSXform( ON_Xform&) const;
689 
690  /*
691  Description:
692  Gets a transform matrix to change from to 3d WCS to the object's 2d ECS
693  Parameters:
694  [out] xform - set to produce the WCS to ECS transform
695  Returns:
696  @untitled table
697  true Success
698  false Failure
699  */
700  bool GetWCStoECSXform( ON_Xform& xform) const;
701 
702  /*
703  Description:
704  Set the object's point array to a specified length
705  Parameters:
706  [in] length - the new size of the array
707  Returns:
708  void
709  */
710  void ReservePoints( int);
711 
712 
713  /*
714  Description:
715  static function to provide the default UserText string for the object
716  Returns:
717  const wchar_t* - the default string to use
718  */
719  static const wchar_t* DefaultText();
720 
721  /*
722  Description:
723  Set or Get the text justification
724  Parameters:
725  justification [in] See enum eJustification for meanings
726  Returns:
727  The justification for the text in this object
728  Comments:
729  This is not implemented on all annotation objects.
730  The default SetJustification() does nothing
731  The default Justification() always returns 0
732 
733  */
734  virtual
735  void SetJustification( unsigned int justification);
736 
737  virtual unsigned int Justification() const;
738 
739  /*
740  Description:
741  Get the transformation that maps the annotation's
742  text to world coordinates.
743  Added Oct 30, 07 LW
744  Parameters:
745  gdi_text_rect - [in]
746  Windows gdi rect of text when it is drawn with
747  LOGFONT lfHeight = ON_Font::Constants::AnnotationFontCellHeight.
748  gdi_height_of_I - [in]
749  Value returned by ON_Font::HeightOfI().
750  dimstyle_textheight - [in]
751  Height of text in world units. If the annotation is
752  an ON_OBSOLETE_V5_TextObject, this is the m_textheight value.
753  If the annotation is not an ON_OBSOLETE_V5_TextObject, pass in
754  the value returned by the dimension style's
755  ON_DimStyle::TextHeight()
756  dimstyle_textgap - [in]
757  The value of the annotation's dimension style's
758  ON_DimStyle::TextGap().
759  dimstyle_textalignment - [in]
760  ON_INTERNAL_OBSOLETE::V5_TextDisplayMode(ON_DimStyle::TextAlignment()).
761  dimscale - [in]
762  Global dimension scaling value. If you are using the
763  Rhino SDK, this value is returned by
764  CRhinoDoc::Properties().AnnotationSettings().DimScale().
765  If you are using the OpenNURBS IO toolkit, this value
766  is on ON_3dmSettings::m_AnnotationSettings.m_dimscale.
767  cameraX - [in]
768  zero or the view's unit camera right vector
769  cameraY - [in]
770  zero or the view's unit camera up vector
771  model_xform - [in] transforms the text's parent entity
772  to world coordinates in case its instance geometry
773  nullptr == Identity
774  text_xform - [out]
775  Returns:
776  True if text_xform is set.
777  */
778  bool GetTextXform(
779  ON_OBSOLETE_V5_RECT gdi_text_rect,
780  int gdi_height_of_I,
781  double dimstyle_textheight,
782  double dimstyle_textgap,
783  ON_INTERNAL_OBSOLETE::V5_TextDisplayMode dimstyle_textalignment,
784  double dimscale,
785  ON_3dVector cameraX,
786  ON_3dVector cameraY,
787  const ON_Xform* model_xform,
788  ON_Xform& text_xform // output
789  ) const;
790 
791  /*
792  Description:
793 
794  This function has been replaced with a version that
795  takes a model transform to transform block instance
796  geometry to world coordinates Oct 30, 07 LW
797 
798  Get the transformation that maps the annotation's
799  text to world coordinates.
800  Parameters:
801  gdi_text_rect - [in]
802  Windows gdi rect of text when it is drawn with
803  LOGFONT lfHeight = ON_Font::Constants::AnnotationFontCellHeight.
804  gdi_height_of_I - [in]
805  Value returned by ON_Font::HeightOfI().
806  dimstyle_textheight - [in]
807  Height of text in world units. If the annotation is
808  an ON_OBSOLETE_V5_TextObject, this is the m_textheight value.
809  If the annotation is not an ON_OBSOLETE_V5_TextObject, pass in
810  the value returned by the dimension style's
811  ON_DimStyle::TextHeight()
812  dimstyle_textgap - [in]
813  The value of the annotation's dimension style's
814  ON_DimStyle::TextGap().
815  dimstyle_textalignment - [in]
816  ON_INTERNAL_OBSOLETE::V5_TextDisplayMode(ON_DimStyle::TextAlignment()).
817  dimscale - [in]
818  Global dimension scaling value. If you are using the
819  Rhino SDK, this value is returned by
820  CRhinoDoc::Properties().AnnotationSettings().DimScale().
821  If you are using the OpenNURBS IO toolkit, this value
822  is on ON_3dmSettings::m_AnnotationSettings.m_dimscale.
823  cameraX - [in]
824  zero or the view's unit camera right vector
825  cameraY - [in]
826  zero or the view's unit camera up vector
827  xform - [out]
828  Returns:
829  True if xform is set.
830  */
831  bool GetTextXform(
832  ON_OBSOLETE_V5_RECT gdi_text_rect,
833  int gdi_height_of_I,
834  double dimstyle_textheight,
835  double dimstyle_textgap,
836  ON_INTERNAL_OBSOLETE::V5_TextDisplayMode dimstyle_textalignment,
837  double dimscale,
838  ON_3dVector cameraX,
839  ON_3dVector cameraY,
840  ON_Xform& xform
841  ) const;
842 
843  /*
844  Description:
845  Get the transformation that maps the annotation's
846  text to world coordinates.
847  Oct 30, 07 LW
848  Parameters:
849  gdi_text_rect - [in]
850  Windows gdi rect of text when it is drawn with
851  LOGFONT lfHeight = ON_Font::Constants::AnnotationFontCellHeight.
852  font - [in]
853  dimstyle - [in]
854  dimscale - [in]
855  Global dimension scaling value. If you are using the
856  Rhino SDK, this value is returned by
857  CRhinoDoc::Properties().AnnotationSettings().DimScale().
858  If you are using the OpenNURBS IO toolkit, this value
859  is on ON_3dmSettings::m_AnnotationSettings.m_dimscale.
860  vp - [in]
861  model_xform - [in] transforms the text's parent entity
862  to world coordinates in case its instance geometry
863  nullptr == Identity
864  text_xform - [out]
865  Returns:
866  True if text_xform is set.
867  */
868  bool GetTextXform(
869  const ON_OBSOLETE_V5_RECT gdi_text_rect,
870  const ON_Font& font,
871  const ON_DimStyle* dimstyle,
872  double dimscale,
873  const ON_Viewport* vp,
874  const ON_Xform* model_xform,
875  ON_Xform& text_xform // output
876  ) const;
877 
878  /*
879  Description:
880  Get the annotation plane coordinates (ECS) of the point
881  that is used to position the text. The relative position
882  of the text to this points depends on the type of
883  annotation, the dimstyle's text alignment flag, and the
884  view projection.
885  This point is not the same as the base point of the text.
886  Parameters:
887  text_point - [out];
888  Returns:
889  True if text_point is set.
890  */
891  bool GetTextPoint( ON_2dPoint& text_2d_point ) const;
892 
893  // enum for tyoe of annotation DimLinear, DimRadius, etc.
894  ON_INTERNAL_OBSOLETE::V5_eAnnotationType m_type;
895 
896  // m_textdisplaymode controls the orientation
897  // of the text.
898  // If m_textdisplaymode = dtHorizontal, then
899  // the text is always horizontal and in the
900  // view plane. Otherwise it lies in m_plane.
901  ON_INTERNAL_OBSOLETE::V5_TextDisplayMode m_textdisplaymode;
902 
903  // m_plane is the plane containing the annotation.
904  // All parts of the annotation that are not
905  // text lie in this plane. If
906  // m_textdisplaymode != dtHorizontal, then
907  // the text lies in the plane too.
908  // (ECS reference plane in WCS coordinates.)
909  ON_Plane m_plane;
910 
911  // Definition points for the dimension.
912  // These are 2d coordinates in m_plane.
913  // The location of these points depends on the
914  // type of annotation class. There is a comment
915  // at the start of the definions for
916  // ON_OBSOLETE_V5_DimLinear, ON_OBSOLETE_V5_DimRadial,
917  // ON_OBSOLETE_V5_DimAngular, ON_OBSOLETE_V5_TextObject, and
918  // ON_OBSOLETE_V5_Leader that explains how the points are used.
919  ON_2dPointArray m_points;
920 
921  // With the addition of tolerances and therefore multi-line
922  // text, the ON_wString in m_usertext will hold multiple
923  // strings with NULLs between them.
924  // The strings will be in this order:
925  // Result of expanding "<>", or user override
926  // Alternate dimension
927  // Tolerance upper
928  // Tolerance lower
929  // Alt tolerance upper
930  // Alt tolerance lower
931  // Prefix
932  // Suffix
933  // Alt prefix
934  // Alt suffix
935  //
936  ON_OBSOLETE_V5_AnnotationText m_usertext;
937 
938  // true: User has positioned text
939  // false: use default location
940  bool m_userpositionedtext;
941  // Added 13 Aug, 2010 - Lowell
942  // This determines whether the object will be scaled according to detail
943  // scale factor or by 1.0 in paperspace rather than by
944  // dimscale or text scale.
945  // For the first try this will only be used on text and its
946  // here on the base class because it would fit and in case
947  // its needed later on dimensions.
948  bool m_annotative_scale;
949 private:
950  bool m_reserved_b1;
951  bool m_reserved_b2;
952 public:
953 
954 private:
955  // At this point, the ON_OBSOLETE_V5_Annotation and derived classes
956  // exists for a single purpose - to support reading and writing
957  // V5 (4,3,2) 3dm archives.
958  // In V5 archives all dimension styles, including per opbject overrrides
959  // were in the archive dimstyle table. In V6 and later, override dimstyles
960  // are managed by the object that uses them.
961  //
962  // This class used to have a single dimstyle table index.
963  // That index has been removed and replaced with the following
964  // information that is parallel to the information on ON_Annotation.
965 
966  // Dimstyle index to use when writing a V5 archive.
967  int m_v5_3dm_archive_dimstyle_index = ON_UNSET_INT_INDEX;
968 
969 public:
970  // Text height in model units
971  // This is used by text, but not by dimensions
972  // Dimensions get their height from dimension styles
973  double m_textheight;
974 
975  // Left, Center, Right / Bottom, Middle, Top text justification
976  // See eTextJustification above
977  unsigned int m_justification;
978 };
979 
980 
981 // Subclass of ON_OBSOLETE_V5_Annotation to provide linear dimensions
982 class ON_OBSOLETE_V5_DimLinear : public ON_OBSOLETE_V5_Annotation
983 {
984  ON_OBJECT_DECLARE(ON_OBSOLETE_V5_DimLinear);
985 
986 public:
987 
988  /*
989  The annotation's dimstyle controls the position of TEXT,
990  the size of the arrowheads, and the amount the ends of
991  linear dimension's extension lines extend beyond the
992  dimension lines.
993 
994  In the picture below, [n] means ON_OBSOLETE_V5_Annotation::m_points[n].
995 
996  [2]
997  |
998  | |
999  [1]-------------------------------------------[3]
1000  | |
1001  | TEXT
1002  | [4]
1003  [0]
1004 
1005  The "x" and "y" coordinates of [0] must be (0.0, 0.0).
1006 
1007  The "x" coordinate of [1] = "x" of [0]
1008  The "y" coordinate of [1] can be any value.
1009 
1010  The "x" and "y" coordinates of [2] can be any value.
1011 
1012  The "x" coordinate of [3] = "x" coordinate of [2].
1013  The "y" coordinate of [3] = "y" coordinate of [1].
1014  */
1015 
1016  enum POINT_INDEX
1017  {
1018  // Do not change these enum values. They are saved in files as the
1019  // ON_COMPONENT_INDEX.m_index value.
1020  //
1021  // Indices of linear dimension definition points in
1022  // the m_points[] array
1023  ext0_pt_index = 0, // end of first extension line
1024  arrow0_pt_index = 1, // arrowhead tip on first extension line
1025  ext1_pt_index = 2, // end of second extension line
1026  arrow1_pt_index = 3, // arrowhead tip on second extension line
1027  userpositionedtext_pt_index = 4,
1028  dim_pt_count = 5, // number of m_points[] in an angular dim
1029 
1030  // Points calculated from values in m_points[]
1031  text_pivot_pt = 10000, // center of dimension text
1032  dim_mid_pt = 10001 // midpoint of dimension line
1033  };
1034 
1035 public:
1036  ON_OBSOLETE_V5_DimLinear();
1037  ~ON_OBSOLETE_V5_DimLinear();
1038  ON_OBSOLETE_V5_DimLinear( const ON_OBSOLETE_V5_DimLinear& ) = default;
1039  ON_OBSOLETE_V5_DimLinear& operator=(const ON_OBSOLETE_V5_DimLinear&) = default;
1040 
1041  /*
1042  Description:
1043  Create a V5 linear dimension from a V6 linear dimension.
1044  The function is used when writing V5 files.
1045  Parameters:
1046  V6_dim_linear -[in]
1047  annotation_context - [in]
1048  Dimstyle and other informtion referenced by V6_dim_linear or nullptr if not available.
1049  destination - [in]
1050  If destination is not nullptr, then the V5 linear dimension is constructed
1051  in destination. If destination is nullptr, then the new V5 linear dimension
1052  is allocated with a call to new ON_OBSOLETE_V5_DimLinear().
1053  */
1054  static ON_OBSOLETE_V5_DimLinear* CreateFromV6DimLinear(
1055  const class ON_DimLinear& V6_dim_linear,
1056  const class ON_3dmAnnotationContext* annotation_context,
1057  ON_OBSOLETE_V5_DimLinear* destination
1058  );
1059 
1060  static ON_OBSOLETE_V5_DimLinear* CreateFromV2LinearDimension(
1061  const class ON_OBSOLETE_V2_DimLinear& V2_linear_dimension,
1062  const class ON_3dmAnnotationContext* annotation_context,
1063  ON_OBSOLETE_V5_DimLinear* destination
1064  );
1065 
1066  // overrides virtual ON_Geometry::Transform()
1067  bool Transform( const ON_Xform& xform ) override;
1068 
1069  /*
1070  Description:
1071  Checks the linear dimension and repairs any point locations or flags
1072  that are not set correctly.
1073  Returns:
1074  0: linear dimension is damaged beyond repair
1075  1: linear dimension was perfect and nothing needed to be repaired.
1076  2: linear dimension had flaws that were repaired.
1077  */
1078  int Repair();
1079 
1080  /*
1081  Description:
1082  Get the m_plane coordinates of the dimension point.
1083  Parameters:
1084  point_index - [in] One of the POINT_INDEX enum values
1085  Returns:
1086  2d point or ON_3dPoint::UnsetPoint if point_index or m_points[]
1087  array is not valid.
1088  */
1089  ON_2dPoint Dim2dPoint(
1090  int point_index
1091  ) const;
1092 
1093  /*
1094  Description:
1095  Get the m_plane coordinates of the dimension point.
1096  Parameters:
1097  point_index - [in] One of the POINT_INDEX enum values
1098  Returns:
1099  2d point or ON_3dPoint::UnsetPoint if point_index or m_points[]
1100  array is not valid.
1101  */
1102  ON_3dPoint Dim3dPoint(
1103  int point_index
1104  ) const;
1105 
1106  // overrides virual ON_Object::IsValid
1107  bool IsValid( ON_TextLog* text_log = nullptr ) const override;
1108 
1109  // overrides virual ON_Object::Write
1110  bool Write(ON_BinaryArchive&) const override;
1111 
1112  // overrides virual ON_Object::Read
1113  bool Read(ON_BinaryArchive&) override;
1114 
1115  // virtual ON_Geometry GetBBox override
1116  bool GetBBox( double* boxmin, double* boxmax, bool bGrowBox = false ) const override;
1117 
1118  // virtual ON_Geometry GetTightBoundingBox override
1119  bool GetTightBoundingBox( class ON_BoundingBox& tight_bbox, bool bGrowBox = false, const class ON_Xform* xform = nullptr ) const override;
1120 
1121  /*
1122  Description:
1123  Overrides virtual ON_OBSOLETE_V5_Annotation::NumericValue();
1124  Returns:
1125  distance between arrow tips
1126  */
1127  double NumericValue() const override;
1128 
1129  /*
1130  Description:
1131  Get or set the DimStyle index in the dimstyle table for the dimension
1132  Parameters:
1133  [in] int the new index (Set)
1134  Returns:
1135  int - The current index (Get)
1136  */
1137  int StyleIndex() const;
1138  void SetStyleIndex( int);
1139 
1140  /*
1141  Description:
1142  static function to provide the default UserText string for the object
1143  Returns:
1144  const wchar_t* - the default string to use
1145  */
1146  static const wchar_t* DefaultText();
1147 
1148 
1149  /*
1150  Description:
1151  Get the annotation plane x coordinates of the dimension
1152  line. The y coordinate of the dimension line is m_ponts[1].y.
1153  Parameters:
1154  gdi_text_rect - [in]
1155  Windows rect (left < right, top < bottom) that bounds text.
1156  The baseline of the text should be at y=0 in the rect coordinates.
1157  gdi_height_of_I - [in]
1158  Height of an I in the text in the same.
1159  gdi_to_world - [in]
1160  transform returned by ON_OBSOLETE_V5_Annotation::GetTextXform().
1161  dimstyle - [in]
1162  dimscale - [in]
1163  vp - [in]
1164  x - [out] plane x coordinates of the dimension line.
1165  The y coordinate = m_points[arrow0_pt_index].y
1166  bInside - [out] true if arrowheads go inside extension lines,
1167  false if they go outside
1168  Returns:
1169  0: the input or class is not valid
1170  1: A single line from x[0] to x[1] with arrow heads at both ends.
1171  Arrowtips at x[4] & x[5]
1172  2: Two lines from x[0] to x[1] and from x[1] to x[2]. The
1173  Arrowtips at x[4] & x[5]
1174 
1175  */
1176  int GetDimensionLineSegments(
1177  ON_OBSOLETE_V5_RECT gdi_text_rect,
1178  int gdi_height_of_I,
1179  ON_Xform gdi_to_world,
1180  const ON_DimStyle& dimstyle,
1181  double dimscale,
1182  const ON_Viewport* vp,
1183  double a[6],
1184  bool& bInside
1185  ) const;
1186 
1187 
1188  // Added for V5. 4/24/07 LW
1189  // Get the userdata extension for this dimension
1190  ON_OBSOLETE_V5_DimExtra* DimensionExtension();
1191  const ON_OBSOLETE_V5_DimExtra* DimensionExtension() const;
1192 };
1193 
1194 //////////
1195 // class ON_OBSOLETE_V5_DimRadial
1196 class ON_OBSOLETE_V5_DimRadial : public ON_OBSOLETE_V5_Annotation
1197 {
1198  ON_OBJECT_DECLARE(ON_OBSOLETE_V5_DimRadial);
1199 
1200 public:
1201 
1202  /*
1203  The annotation's dimstyle controls the position of TEXT,
1204  and the size of the arrowheads.
1205 
1206  In the picture below, [n] means ON_OBSOLETE_V5_Annotation::m_points[n].
1207 
1208  Radial dimensions do not permit user positioned text
1209 
1210 
1211  knee
1212  [3]--------[2] TEXT
1213  / (tail)
1214  /
1215  /
1216  [1] (arrow head here)
1217 
1218 
1219  + [0] = (usually at (0,0) = center of circle)
1220  */
1221 
1222  enum POINT_INDEX
1223  {
1224  // Do not change these enum values. They are saved in files as the
1225  // ON_COMPONENT_INDEX.m_index value.
1226  //
1227  // Indices of radial dimension definition points in
1228  // the m_points[] array
1229  center_pt_index = 0, // location of + (usually at center of circle)
1230  arrow_pt_index = 1, // arrow tip
1231  tail_pt_index = 2, // end of radial dimension
1232  knee_pt_index = 3, // number of m_points[] in a radial dim
1233  dim_pt_count = 4, // number of m_points[] in a radial dim
1234 
1235  // Points calculated from values in m_points[]
1236  text_pivot_pt = 10000, // start/end of dimension text at tail
1237  };
1238 
1239  ON_OBSOLETE_V5_DimRadial();
1240  ~ON_OBSOLETE_V5_DimRadial() = default;
1241  ON_OBSOLETE_V5_DimRadial(const ON_OBSOLETE_V5_DimRadial&) = default;
1242  ON_OBSOLETE_V5_DimRadial& operator=(const ON_OBSOLETE_V5_DimRadial&) = default;
1243 
1244 
1245  static ON_OBSOLETE_V5_DimRadial* CreateFromV6DimRadial(
1246  const class ON_DimRadial& V6_dim_radial,
1247  const class ON_3dmAnnotationContext* annotation_context,
1248  ON_OBSOLETE_V5_DimRadial* destination
1249  );
1250 
1251  static ON_OBSOLETE_V5_DimRadial* CreateFromV2RadialDimension(
1252  const class ON_OBSOLETE_V2_DimRadial& V2_radial_dimension,
1253  const class ON_3dmAnnotationContext* annotation_context,
1254  ON_OBSOLETE_V5_DimRadial* destination
1255  );
1256 
1257  // overrides virtual ON_Geometry::Transform()
1258  bool Transform( const ON_Xform& xform ) override;
1259 
1260  /*
1261  Description:
1262  Get the m_plane coordinates of the dimension point.
1263  Parameters:
1264  point_index - [in] One of the POINT_INDEX enum values
1265  Returns:
1266  2d point or ON_3dPoint::UnsetPoint if point_index or m_points[]
1267  array is not valid.
1268  */
1269  ON_2dPoint Dim2dPoint(
1270  int point_index
1271  ) const;
1272 
1273  /*
1274  Description:
1275  Get the m_plane coordinates of the dimension point.
1276  Parameters:
1277  point_index - [in] One of the POINT_INDEX enum values
1278  Returns:
1279  2d point or ON_3dPoint::UnsetPoint if point_index or m_points[]
1280  array is not valid.
1281  */
1282  ON_3dPoint Dim3dPoint(
1283  int point_index
1284  ) const;
1285 
1286 
1287  // overrides virual ON_Object::IsValid
1288  bool IsValid( ON_TextLog* text_log = nullptr ) const override;
1289 
1290  // overrides virual ON_Object::Write
1291  bool Write(ON_BinaryArchive&) const override;
1292 
1293  // overrides virual ON_Object::Read
1294  bool Read(ON_BinaryArchive&) override;
1295 
1296  // virtual ON_Geometry GetBBox override
1297  bool GetBBox( double* boxmin, double* boxmax, bool bGrowBox = false ) const override;
1298 
1299  // virtual ON_Geometry GetTightBoundingBox override
1300  bool GetTightBoundingBox( class ON_BoundingBox& tight_bbox, bool bGrowBox = false, const class ON_Xform* xform = nullptr ) const override;
1301 
1302  /*
1303  Description:
1304  Set the plane and definition points from WCS 3d input
1305  Parameters:
1306  center - [in] center of circle
1307  arrowtip - [in] 3d point on the circle at the dimension arrow tip
1308  xaxis - [in] x axis of the dimension's plane
1309  normal - [in] normal to the dimension's plane
1310  offset_distance - [in] distance from arrow tip to knee point
1311  Returns:
1312  @untitled table
1313  true Success
1314  false Failure
1315  */
1316  bool CreateFromPoints(
1317  ON_3dPoint center,
1318  ON_3dPoint arrowtip,
1319  ON_3dVector xaxis,
1320  ON_3dVector normal,
1321  double offset_distance
1322  );
1323 
1324  /*
1325  Description:
1326  Overrides virtual ON_OBSOLETE_V5_Annotation::NumericValue();
1327  Returns:
1328  If m_type is ON_INTERNAL_OBSOLETE::V5_eAnnotationType::dtDimDiameter, then the diameter
1329  is returned, othewise the radius is returned.
1330  */
1331  double NumericValue() const override;
1332 
1333  /*
1334  Description:
1335  Get or set the DimStyle index in the dimstyle table for the dimension
1336  Parameters:
1337  [in] int the new index (Set)
1338  Returns:
1339  int - The current index (Get)
1340  */
1341  int StyleIndex() const;
1342  void SetStyleIndex( int);
1343 
1344  /*
1345  Description:
1346  static function to provide the default UserText string for the object
1347  Returns:
1348  const wchar_t* - the default string to use
1349  */
1350  static const wchar_t* DefaultDiameterText();
1351  static const wchar_t* DefaultRadiusText();
1352 
1353  bool CreateFromV2(
1354  const class ON_OBSOLETE_V2_Annotation& v2_ann,
1355  const class ON_3dmAnnotationSettings& settings,
1356  int dimstyle_index
1357  );
1358 
1359  bool GetArrowHeadDirection( ON_2dVector& arrowhead_dir ) const;
1360  bool GetArrowHeadTip( ON_2dPoint& arrowhead_tip ) const;
1361 };
1362 
1363 
1364 //////////
1365 // class ON_OBSOLETE_V5_DimAngular
1366 class ON_OBSOLETE_V5_DimAngular : public ON_OBSOLETE_V5_Annotation
1367 {
1368  ON_OBJECT_DECLARE(ON_OBSOLETE_V5_DimAngular);
1369 
1370 public:
1371 
1372  /*
1373  The annotation's dimstyle controls the position of TEXT,
1374  the size of the arrowheads, and the amount the ends of
1375  linear dimension's extension lines extend beyond the
1376  dimension lines.
1377 
1378  In the picture below, [n] means ON_OBSOLETE_V5_Annotation::m_points[n].
1379 
1380  [0] = if m_userpositionedtext=true, this is the center of text.
1381  If m_userpositionedtext=false, this point is not used and
1382  the center of the text is at the arc's midpoint.
1383 
1384  Always counter clockwise arc in m_plane with center = (0,0)
1385  [1] = a point somewhere on the line from the center through the start point.
1386  The distance from center to [1] can be any value.
1387  [2] = a point somewhere on the line from the center through the end point.
1388  The distance from center to [2] can be any value.
1389  [3] = a point on the interior of the arc. The distance
1390  from (0,0) to [3] is the radius of the arc.
1391 
1392 
1393  /
1394  [2]
1395  /
1396  / [0]TEXT
1397  /
1398  / [3]
1399  -----(0,0)----------[1]---
1400  /
1401  /
1402  /
1403 
1404  */
1405 
1406  enum POINT_INDEX
1407  {
1408  // Do not change these enum values. They are saved in files as the
1409  // ON_COMPONENT_INDEX.m_index value.
1410  //
1411  // Indices of angular dimension definition points in
1412  // the m_points[] array
1413  userpositionedtext_pt_index = 0, //
1414  start_pt_index = 1, // point on the start ray (not necessarily on arc)
1415  end_pt_index = 2, // point on the end ray (not necessarily on arc)
1416  arc_pt_index = 3, // point on the interior of dimension arc
1417  dim_pt_count = 4, // number of m_points[] in an angular dim
1418 
1419  // Points calculated from values in m_points[]
1420  text_pivot_pt = 10000, // center of dimension text
1421  arcstart_pt = 10001,
1422  arcend_pt = 10002,
1423  arcmid_pt = 10003,
1424  arccenter_pt = 10004, // center of circle arc lies on
1425  extension0_pt = 10005, // point where first extension line starts
1426  extension1_pt = 10006 // point where second extension line starts
1427  };
1428 
1429 public:
1430  ON_OBSOLETE_V5_DimAngular();
1431  ~ON_OBSOLETE_V5_DimAngular() = default;
1432  ON_OBSOLETE_V5_DimAngular(const ON_OBSOLETE_V5_DimAngular&) = default;
1433  ON_OBSOLETE_V5_DimAngular& operator=(const ON_OBSOLETE_V5_DimAngular&) = default;
1434 
1435  static ON_OBSOLETE_V5_DimAngular* CreateFromV6DimAngular(
1436  const class ON_DimAngular& V6_dim_angular,
1437  const class ON_3dmAnnotationContext* annotation_context,
1438  ON_OBSOLETE_V5_DimAngular* destination
1439  );
1440 
1441  static ON_OBSOLETE_V5_DimAngular* CreateFromV2AngularDimension(
1442  const class ON_OBSOLETE_V2_DimAngular& V2_angular_dimension,
1443  const class ON_3dmAnnotationContext* annotation_context,
1444  ON_OBSOLETE_V5_DimAngular* destination
1445  );
1446 
1447 
1448  // overrides virtual ON_Geometry::Transform()
1449  bool Transform( const ON_Xform& xform ) override;
1450 
1451  /*
1452  Description:
1453  Get the m_plane coordinates of the dimension point.
1454  Parameters:
1455  point_index - [in] One of the POINT_INDEX enum values
1456  Returns:
1457  2d point or ON_3dPoint::UnsetPoint if point_index or m_points[]
1458  array is not valid.
1459  */
1460  ON_2dPoint Dim2dPoint(
1461  int point_index
1462  ) const;
1463 
1464  /*
1465  Description:
1466  Get the m_plane coordinates of the dimension point.
1467  Parameters:
1468  point_index - [in] One of the POINT_INDEX enum values
1469  Returns:
1470  2d point or ON_3dPoint::UnsetPoint if point_index or m_points[]
1471  array is not valid.
1472  */
1473  ON_3dPoint Dim3dPoint(
1474  int point_index
1475  ) const;
1476 
1477 
1478  // overrides virual ON_Object::IsValid
1479  bool IsValid( ON_TextLog* text_log = nullptr ) const override;
1480 
1481  // virtual ON_Geometry GetBBox override
1482  bool GetBBox( double* boxmin, double* boxmax, bool bGrowBox = false ) const override;
1483 
1484  // virtual ON_Geometry GetTightBoundingBox override
1485  bool GetTightBoundingBox( class ON_BoundingBox& tight_bbox, bool bGrowBox = false, const class ON_Xform* xform = nullptr ) const override;
1486 
1487  /*
1488  Description:
1489  Read from or write to a file
1490  Returns:
1491  @untitled Table
1492  true Success
1493  false Failure
1494  */
1495  bool Write( ON_BinaryArchive& file ) const override;
1496  bool Read( ON_BinaryArchive& file ) override;
1497 
1498  /*
1499  Description:
1500  Set the plane and definition points from 3d points
1501  in world coordinates.
1502  Parameters:
1503  apex - [in] 3d apex of the dimension
1504  (center of arc)
1505  p0 - [in] 3d point on first line
1506  p1 - [in] 3d point on second line
1507  arcpt - [in] 3d point on dimension arc
1508  (determines radius of arc)
1509  Normal - [in] normal of the plane on which to make the dimension
1510  (must be perpendicular to p0-apex and p1-apex)
1511  Returns:
1512  @untitled table
1513  true Success
1514  false Failure
1515  */
1516  bool CreateFromPoints(
1517  const ON_3dPoint& apex,
1518  const ON_3dPoint& p0,
1519  const ON_3dPoint& p1,
1520  ON_3dPoint& arcpt,
1521  ON_3dVector& Normal
1522  );
1523 
1524  /*
1525  Description:
1526  Set the plane and definition points from a 3d arc.
1527  Parameters:
1528  arc - [in]
1529  Returns:
1530  @untitled table
1531  true Success
1532  false Failure
1533  */
1534  bool CreateFromArc(
1535  const ON_Arc& arc
1536  );
1537 
1538  bool GetArc( ON_Arc& arc ) const;
1539 
1540  bool GetExtensionLines(ON_Line extensions[2]) const;
1541 
1542  // Set or get the measured angle in radians
1543  void SetAngle( double angle);
1544  double Angle() const;
1545  void SetRadius( double radius);
1546  double Radius() const;
1547 
1548  /*
1549  Description:
1550  Overrides virtual ON_OBSOLETE_V5_Annotation::NumericValue();
1551  Returns:
1552  Angle in degrees
1553  */
1554  double NumericValue() const override;
1555 
1556  /*
1557  Description:
1558  Get or set the DimStyle index in the dimstyle table for the dimension
1559  Parameters:
1560  [in] int the new index (Set)
1561  Returns:
1562  int - The current index (Get)
1563  */
1564  int StyleIndex() const;
1565  void SetStyleIndex( int);
1566 
1567  /*
1568  Description:
1569  static function to provide the default UserText string for the object
1570  Returns:
1571  const wchar_t* - the default string to use
1572  */
1573  static const wchar_t* DefaultText();
1574 
1575  double m_angle = 0.0; // angle being dimensioned
1576  double m_radius = 1.0; // radius for dimension arc
1577 
1578  /*
1579  Description:
1580  Get the annotation plane angles of the dimension arc.
1581  Parameters:
1582  gdi_text_rect - [in] Windows rect (left < right, top < bottom)
1583  that bounds text.
1584  gdi_height_of_I - [in]
1585  Height of an I in the text.
1586  gdi_to_world - [in]
1587  transform returned by ON_OBSOLETE_V5_Annotation::GetTextXform().
1588  dimstyle - [in]
1589  dimscale - [in]
1590  vp - [in]
1591  a - [out]
1592  angles at the ends of the arc segment(s) and the arrow tips
1593  bInside - [out] true if arrowheads go inside, false if they go outside
1594  Returns:
1595  number of arc segments to draw
1596  0: the input or class is not valid
1597  1: A single arc from a[0] to a[1] with arrow heads at a[4] & a[5].
1598  2: Two arcs from a[0] to a[1] & from a[2] to a[3].
1599  Arrowheads are at a[4] & a[5].
1600  */
1601  int GetDimensionArcSegments(
1602  ON_OBSOLETE_V5_RECT gdi_text_rect,
1603  int gdi_height_of_I,
1604  ON_Xform gdi_to_world,
1605  const ON_DimStyle& dimstyle,
1606  double dimscale,
1607  const ON_Viewport* vp,
1608  double a[6],
1609  bool& bInside
1610  ) const;
1611 
1612 
1613  /*
1614  Description:
1615  Get distance from dimension apex to extension line offset points
1616  Parameters:
1617  index - [in] which distance to get
1618  Returns:
1619  Distance to offset point [index]
1620  */
1621  double DimpointOffset(
1622  int index) const;
1623 
1624  /*
1625  Description:
1626  Set distance from dimension apex to extension line offset points
1627  Parameters:
1628  index - [in] which distance to set
1629  offset - [in] Value to set
1630  */
1631  void SetDimpointOffset(
1632  int index,
1633  double offset);
1634 };
1635 
1636 
1637 /*
1638  class ON_OBSOLETE_V5_DimLinear
1639 
1640  Description:
1641  Override od ON_OBSOLETE_V5_Annotation to provide linear dimensions
1642 */
1643 class ON_OBSOLETE_V5_DimOrdinate : public ON_OBSOLETE_V5_Annotation
1644 {
1645  ON_OBJECT_DECLARE(ON_OBSOLETE_V5_DimOrdinate);
1646 
1647 public:
1648 
1649  /*
1650  In the picture below, [n] means ON_OBSOLETE_V5_Annotation::m_points[n].
1651 
1652  Measures in X direction
1653 
1654  [1]
1655  |
1656  |
1657  |
1658  |
1659  |
1660  [0]
1661  +
1662  [plane origin] [plane origin]
1663  +
1664 
1665  or - Measures in Y direction *---[1]
1666  /
1667  /
1668  [0]--------------------[1] [0]---------------*
1669 
1670 
1671  * = calculated, not stored
1672 
1673 
1674  +
1675  [plane origin]
1676 
1677 
1678  The reference point of for the dimension is at the entity plane origin
1679  The "x" and "y" coordinates of [1] can be any value.
1680  The "x" and "y" coordinates of [2] can be any value.
1681  If Direction is "x", the dimension measures along the "x" axis
1682  If Direction is "y", the dimension measures along the "y" axis
1683  If Direction is "x" and [1][x] <> [0][x], an offset segment is drawn
1684  If Direction is "y" and [1][y] <> [0][y], an offset segment is drawn
1685  The dimension lines are always drawn in the X or Y directions of the entity plane
1686  The distance represented by the dimension is measured from the
1687  plane origin to point [0], parallel to the appropriate axis.
1688  The points of the offset segment are calculated rather than stored
1689  */
1690 
1691  enum POINT_INDEX
1692  {
1693  // Do not change these enum values. They are saved in files as the
1694  // ON_COMPONENT_INDEX.m_index value.
1695  //
1696  // Indices of linear dimension definition points in
1697  // the m_points[] array
1698  definition_pt_index = 0, // First end of the dimension line
1699  leader_end_pt_index = 1, // Other end of the leader (near the text)
1700  dim_pt_count = 2, // Number of m_points[] in an ordinate dim
1701 
1702  // Points calculated from values in m_points[]
1703  text_pivot_pt = 10000, // Center of dimension text
1704  offset_pt_0 = 10001, // First offset point (nearest text)
1705  offset_pt_1 = 10002 // Second offset point
1706  };
1707 
1708  enum DIRECTION
1709  {
1710  x = 0, // measures horizontally
1711  y = 1, // measures vertically
1712  };
1713 
1714  ON_OBSOLETE_V5_DimOrdinate();
1715  ~ON_OBSOLETE_V5_DimOrdinate();
1716 
1717  static ON_OBSOLETE_V5_DimOrdinate* CreateFromV6DimOrdinate(
1718  const class ON_DimOrdinate& V6_dim_ordinate,
1719  const class ON_3dmAnnotationContext* annotation_context,
1720  ON_OBSOLETE_V5_DimOrdinate* destination
1721  );
1722 
1723 
1724  // overrides virtual ON_Geometry::Transform()
1725  bool Transform( const ON_Xform& xform ) override;
1726 
1727  /*
1728  Description:
1729  Get the m_plane coordinates of the dimension point.
1730  Parameters:
1731  point_index - [in] One of the POINT_INDEX enum values
1732  default_offset [in] - kink offset to use if m_kink_offset_0
1733  or m_kink_offset_1 are ON_UNSET_VALUE
1734  Returns:
1735  2d point or ON_3dPoint::UnsetPoint if point_index or m_points[]
1736  array is not valid.
1737  */
1738  ON_2dPoint Dim2dPoint(
1739  int point_index,
1740  double default_offset = 1.0
1741  ) const;
1742 
1743  /*
1744  Description:
1745  Get the m_plane coordinates of the dimension point.
1746  Parameters:
1747  point_index - [in] One of the POINT_INDEX enum values
1748  default_offset [in] - kink offset to use if m_kink_offset_0
1749  or m_kink_offset_1 are ON_UNSET_VALUE
1750  Returns:
1751  2d point or ON_3dPoint::UnsetPoint if point_index or m_points[]
1752  array is not valid.
1753  */
1754  ON_3dPoint Dim3dPoint(
1755  int point_index,
1756  double default_offset = 1.0
1757  ) const;
1758 
1759  // overrides virual ON_Object::IsValid
1760  bool IsValid( ON_TextLog* text_log = nullptr ) const override;
1761 
1762  // virtual ON_Geometry GetBBox override
1763  bool GetBBox( double* boxmin, double* boxmax, bool bGrowBox = false ) const override;
1764 
1765  // virtual ON_Geometry GetTightBoundingBox override
1766  bool GetTightBoundingBox( class ON_BoundingBox& tight_bbox, bool bGrowBox = false, const class ON_Xform* xform = nullptr ) const override;
1767 
1768  /*
1769  Description:
1770  Read from or write to a file
1771  Returns:
1772  @untitled Table
1773  true Success
1774  false Failure
1775  */
1776  bool Write( ON_BinaryArchive& file ) const override;
1777  bool Read( ON_BinaryArchive& file ) override;
1778 
1779  /*
1780  Description:
1781  Overrides virtual ON_OBSOLETE_V5_Annotation::NumericValue();
1782  Returns:
1783  If Direction is 'X', x coordinate of point[1]
1784  If Direction is 'Y', y coordinate of point[1]
1785  */
1786  double NumericValue() const override;
1787 
1788  /*
1789  Description:
1790  Get or set the DimStyle index in the dimstyle table for the dimension
1791  Parameters:
1792  [in] int the new index (Set)
1793  Returns:
1794  int - The current index (Get)
1795  */
1796  int StyleIndex() const;
1797  void SetStyleIndex( int);
1798 
1799  /*
1800  Description:
1801  Gets the direction ( X or Y) that the ordinate dimension measures
1802  based on the relative location of the defining point and leader endpoint
1803  Returns:
1804  0: measures parallel to the entity plane x axis
1805  1: measures parallel to the entity plane y axis
1806  Remarks:
1807  This does not consider the dimension's explicit Direction setting
1808  */
1809  int ImpliedDirection() const;
1810 
1811  /*
1812  Description:
1813  Gets or sets the direction ( X or Y) that the ordinate dimension measures
1814  Returns:
1815  -1: direction determined by dim point and leader point
1816  0: measures parallel to the entity plane x axis
1817  1: measures parallel to the entity plane y axis
1818  */
1819  int Direction() const;
1820  void SetDirection( int direction);
1821 
1822  /*
1823  Description:
1824  Get the height of the text in this dimension
1825  by asking the dimension's dimstyle
1826  Returns:
1827  double Height of the text
1828  Remarks:
1829  Height is in model units
1830  double Height() const;
1831  */
1832 
1833  /*
1834  Description:
1835  static function to provide the default UserText string for the object
1836  Returns:
1837  const wchar_t* - the default string to use
1838  */
1839  static const wchar_t* DefaultText();
1840 
1841  /*
1842  Description:
1843  Returns or sets the offset distance parallel to the dimension
1844  line direction of from the text end of the dimension line to
1845  the offset point
1846  If the offset point hasn't been explicitly defined, returns
1847  ON_UNSET_VALUE and a default should be used to find the point.
1848  Parameters:
1849  index [in] - which offset distance to return
1850  (0 is closer to the text)
1851  offset [in] - the offset distance to set
1852  */
1853  double KinkOffset( int index) const;
1854  void SetKinkOffset( int index, double offset);
1855 
1856 
1857  int m_direction; // -1 == underermined
1858  // 0 == x direction
1859  // 1 == y direction
1860 
1861  // kink offsets added 2-4-06 - LW
1862  double m_kink_offset_0; // from leader_end_point to first break point
1863  double m_kink_offset_1; // from first break point to second break point
1864 
1865  /*
1866  Description:
1867  Calculates the 2d point locations of the dimension line kinks
1868 
1869  Parameters:
1870  p0, p1 [in] - End points of the dimension line
1871  direction [in] - orientation of the dimension
1872  default_offset [in] - Use this if offsets are ON_UNSET_VALUE
1873  k0, k1 [out] - The kink points
1874  Remarks:
1875  The offsets must be set to the right values before calling this, or
1876  If they are ON_UNSET_VALUE, they will be set to the defaults
1877  */
1878  void CalcKinkPoints( ON_2dPoint p0, ON_2dPoint p1,
1879  int direction, double default_offset,
1880  ON_2dPoint& k0, ON_2dPoint& k1) const;
1881 
1882 };
1883 
1884 
1885 //////////
1886 // class ON_OBSOLETE_V5_TextObject
1887 class ON_OBSOLETE_V5_TextObject : public ON_OBSOLETE_V5_Annotation
1888 {
1889  ON_OBJECT_DECLARE(ON_OBSOLETE_V5_TextObject);
1890 
1891 public:
1892  ON_OBSOLETE_V5_TextObject();
1893  ~ON_OBSOLETE_V5_TextObject();
1894 
1895  /*
1896  Description:
1897  Create a V6 text object from a V5 text object.
1898  The function is used when writing V5 files.
1899  Parameters:
1900  v6_text_object -[in]
1901  dimstyle - [in]
1902  Dimstyle referenced by v6_text_object or nullptr if not available.
1903  destination - [in]
1904  If destination is not nullptr, then the V5 text object is constructed
1905  in destination. If destination is nullptr, then the new V5 text object
1906  is allocated with a call to new ON_OBSOLETE_V5_TextObject().
1907  */
1908  static ON_OBSOLETE_V5_TextObject* CreateFromV6TextObject(
1909  const class ON_Text& V6_text_object,
1910  const class ON_3dmAnnotationContext* annotation_context,
1911  ON_OBSOLETE_V5_TextObject* destination
1912  );
1913 
1914  static ON_OBSOLETE_V5_TextObject* CreateFromV2TextObject(
1915  const class ON_OBSOLETE_V2_TextObject& V2_text_object,
1916  const class ON_3dmAnnotationContext* annotation_context,
1917  ON_OBSOLETE_V5_TextObject* destination
1918  );
1919 
1920  // overrides virual ON_Object::IsValid
1921  // Text entities with strings that contain no "printable" characters
1922  // are considered to be NOT valid.
1923  bool IsValid( ON_TextLog* text_log = nullptr ) const override;
1924 
1925  // overrides virual ON_Object::Write
1926  bool Write(ON_BinaryArchive&) const override;
1927 
1928  // overrides virual ON_Object::Read
1929  bool Read(ON_BinaryArchive&) override;
1930 
1931  // overrides virtual ON_Geometry::Transform()
1932  bool Transform( const ON_Xform& xform ) override;
1933 
1934  // virtual ON_Geometry GetBBox override
1935  bool GetBBox( double* boxmin, double* boxmax, bool bGrowBox = false ) const override;
1936 
1937  // virtual ON_Geometry GetTightBoundingBox override
1938  bool GetTightBoundingBox( class ON_BoundingBox& tight_bbox, bool bGrowBox = false, const class ON_Xform* xform = nullptr ) const override;
1939 
1940  void SetJustification( unsigned int justification) override;
1941 
1942  unsigned int Justification() const override;
1943 
1944  // Determines whether or not to draw a Text Mask
1945  bool DrawTextMask() const;
1946  void SetDrawTextMask(bool bDraw);
1947 
1948  // Determines where to get the color to draw a Text Mask
1949  // 0: Use background color of the viewport. Initially, gradient backgrounds will not be supported
1950  // 1: Use the ON_Color returned by MaskColor()
1951  int MaskColorSource() const;
1952  void SetMaskColorSource(int source);
1953 
1954  ON_Color MaskColor() const; // Only works right if MaskColorSource returns 1.
1955  // Does not return viewport background color
1956  void SetMaskColor(ON_Color color);
1957 
1958  // Offset for the border around text to the rectangle used to draw the mask
1959  // This number * CRhinoAnnotation::TextHeight() for the text is the offset
1960  // on each side of the tight rectangle around the text characters to the mask rectangle.
1961  double MaskOffsetFactor() const;
1962  void SetMaskOffsetFactor(double offset);
1963 
1964  // Scale annotation according to detail scale factor in paperspace
1965  // or by 1.0 in paperspace and not in a detail
1966  // Otherwise, dimscale or text scale is used
1967  bool AnnotativeScaling() const;
1968  void SetAnnotativeScaling(bool b);
1969 };
1970 
1971 //////////
1972 // class ON_OBSOLETE_V5_Leader
1973 class ON_OBSOLETE_V5_Leader : public ON_OBSOLETE_V5_Annotation
1974 {
1975  ON_OBJECT_DECLARE(ON_OBSOLETE_V5_Leader);
1976 
1977 public:
1978 
1979  /*
1980  The annotation's dimstyle controls the position of TEXT,
1981  the size of the arrowheads, and the amount the ends of
1982  linear dimension's extension lines extend beyond the
1983  dimension lines.
1984 
1985  Leaders:
1986 
1987  Polyline with N=m_points.Count() points (N >= 2).
1988 
1989  [N-2] ----- [N-1] TEXT
1990  / (tail)
1991  /
1992  /
1993  [1]------[2]
1994  /
1995  /
1996  /
1997  [0] (arrow)
1998 
1999  Leaders ignore the m_userpositionedtext setting. If the
2000  default leader text handling is not adequate, then use
2001  a leader with no text and an ON_OBSOLETE_V5_TextObject.
2002  */
2003 
2004  enum POINT_INDEX
2005  {
2006  // Do not change these enum values. They are saved in files as the
2007  // ON_COMPONENT_INDEX.m_index value.
2008  //
2009  // Indices of leader definition points in
2010  // the m_points[] array
2011  arrow_pt_index = 0, // arrow tip
2012 
2013  // Points calculated from values in m_points[]
2014  text_pivot_pt = 10000, // start/end of dimension text at tail
2015  tail_pt = 10001
2016  };
2017 
2018  // Constructors
2019  ON_OBSOLETE_V5_Leader();
2020  ~ON_OBSOLETE_V5_Leader();
2021  // C++ automatically provides the correct copy constructor and operator= .
2022  //ON_OBSOLETE_V5_Leader(const ON_OBSOLETE_V5_Leader&);
2023  //ON_OBSOLETE_V5_Leader& operator=(const ON_OBSOLETE_V5_Leader&);
2024 
2025  /*
2026  Description:
2027  Create a V5 leader from a V6 leader.
2028  The function is used when writing V5 files.
2029  Parameters:
2030  v6_leader -[in]
2031  dimstyle - [in]
2032  Dimstyle referenced by v6_leader or nullptr if not available.
2033  destination - [in]
2034  If destination is not nullptr, then the V5 leader is constructed
2035  in destination. If destination is nullptr, then the new V5 leader
2036  is allocated with a call to new ON_V5_Leader().
2037  */
2038  static ON_OBSOLETE_V5_Leader* CreateFromV6Leader(
2039  const class ON_Leader& V6_leader,
2040  const class ON_3dmAnnotationContext* annotation_context,
2041  ON_OBSOLETE_V5_Leader* destination
2042  );
2043 
2044 
2045  static ON_OBSOLETE_V5_Leader* CreateFromV2Leader(
2046  const class ON_OBSOLETE_V2_Leader& V2_leader,
2047  const class ON_3dmAnnotationContext* annotation_context,
2048  ON_OBSOLETE_V5_Leader* destination
2049  );
2050 
2051  // overrides virtual ON_Geometry::Transform()
2052  bool Transform( const ON_Xform& xform ) override;
2053 
2054  /*
2055  Description:
2056  Get the m_plane coordinates of the dimension point.
2057  Parameters:
2058  point_index - [in] One of the POINT_INDEX enum values
2059  Returns:
2060  2d point or ON_3dPoint::UnsetPoint if point_index or m_points[]
2061  array is not valid.
2062  */
2063  ON_2dPoint Dim2dPoint(
2064  int point_index
2065  ) const;
2066 
2067  /*
2068  Description:
2069  Get the m_plane coordinates of the dimension point.
2070  Parameters:
2071  point_index - [in] One of the POINT_INDEX enum values
2072  Returns:
2073  2d point or ON_3dPoint::UnsetPoint if point_index or m_points[]
2074  array is not valid.
2075  */
2076  ON_3dPoint Dim3dPoint(
2077  int point_index
2078  ) const;
2079 
2080  // overrides virual ON_Object::IsValid
2081  bool IsValid( ON_TextLog* text_log = nullptr ) const override;
2082 
2083  // overrides virual ON_Object::Write
2084  bool Write(ON_BinaryArchive&) const override;
2085 
2086  // overrides virual ON_Object::Read
2087  bool Read(ON_BinaryArchive&) override;
2088 
2089  // virtual ON_Geometry GetBBox override
2090  bool GetBBox( double* boxmin, double* boxmax, bool bGrowBox = false ) const override;
2091 
2092  // virtual ON_Geometry GetTightBoundingBox override
2093  bool GetTightBoundingBox( class ON_BoundingBox& tight_bbox, bool bGrowBox = false, const class ON_Xform* xform = nullptr ) const override;
2094 
2095  /*
2096  Description:
2097  Add or delete points to the leader
2098  Parameters:
2099  index [in] the point to delete
2100  point [in] The point to add
2101  Returns:
2102  @untitled table
2103  true Success
2104  False Failure
2105  */
2106  void AddPoint( const ON_2dPoint& point);
2107  bool RemovePoint( int index = -1);
2108 
2109 // April 22, 2010 Lowell - Added to support right justified text on left pointing leader tails rr64292
2110  bool GetTextDirection( ON_2dVector& text_dir ) const;
2111  bool GetArrowHeadDirection( ON_2dVector& arrowhead_dir ) const;
2112  bool GetArrowHeadTip( ON_2dPoint& arrowhead_tip ) const;
2113 };
2114 
2115 #endif
2116 
2117 #endif
Definition: opennurbs_annotationbase.h:23
ON_UUID is a 16 byte universally unique identifier.
Definition: opennurbs_uuid.h:32
Definition: opennurbs_dimension.h:401
An ON_Arc is a subcurve of 3d circle.
Definition: opennurbs_arc.h:33
ON_Leader class.
Definition: opennurbs_leader.h:23
Definition: opennurbs_dimension.h:202
Definition: opennurbs_string.h:2020
Definition: opennurbs_dimensionstyle.h:218
Context for an annotation object. This context is required when converting current annotation objects...
Definition: opennurbs_archive.h:1592
Base class for all geometry classes that must provide runtime class id. Provides interface for common...
Definition: opennurbs_geometry.h:37
Definition: opennurbs_color.h:24
Definition: opennurbs_point.h:277
Definition: opennurbs_3dm_settings.h:110
Definition: opennurbs_dimension.h:665
Definition: opennurbs_bounding_box.h:25
Definition: opennurbs_xform.h:28
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_dimension.h:818
Definition: opennurbs_line.h:20
Definition: opennurbs_textlog.h:20
Definition: opennurbs_archive.h:1783
Definition: opennurbs_viewport.h:31
Definition: opennurbs_userdata.h:20
Definition: opennurbs_objref.h:163
Definition: opennurbs_point.h:460
Definition: opennurbs_plane.h:20
Definition: opennurbs_textobject.h:18
Definition: opennurbs_point.h:839
Definition: opennurbs_point.h:1152
Definition: opennurbs_point.h:1973