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