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