opennurbs_annotation.h
Go to the documentation of this file.
00001 /* $NoKeywords: $ */
00002 /*
00003 //
00004 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
00005 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
00006 // McNeel & Associates.
00007 //
00008 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
00009 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
00010 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
00011 //                              
00012 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
00013 //
00015 */
00016 
00017 #if !defined(OPENNURBS_ANNOTATION_INC_)
00018 #define OPENNURBS_ANNOTATION_INC_
00019 
00020 
00021 class ON_CLASS ON_AnnotationTextDot : public ON_Point
00022 {
00023   // 3d annotation dot with text
00024   ON_OBJECT_DECLARE(ON_AnnotationTextDot);
00025 public:
00026   ON_AnnotationTextDot();
00027   ~ON_AnnotationTextDot();
00028   ON_AnnotationTextDot(const ON_AnnotationTextDot&);
00029   ON_AnnotationTextDot& operator=(const ON_AnnotationTextDot&);
00030 
00032   //
00033   // ON_Object overrides
00034   //
00035 
00036   /*
00037   Description:
00038     Tests an object to see if its data members are correctly
00039     initialized.
00040   Parameters:
00041     text_log - [in] if the object is not valid and text_log
00042         is not NULL, then a brief englis description of the
00043         reason the object is not valid is appened to the log.
00044         The information appended to text_log is suitable for 
00045         low-level debugging purposes by programmers and is 
00046         not intended to be useful as a high level user 
00047         interface tool.
00048   Returns:
00049     @untitled table
00050     true     object is valid
00051     false    object is invalid, uninitialized, etc.
00052   Remarks:
00053     Overrides virtual ON_Object::IsValid
00054   */
00055   ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
00056 
00057   void Dump( ON_TextLog& ) const; // for debugging
00058 
00059   ON_BOOL32 Write(
00060          ON_BinaryArchive&  // serialize definition to binary archive
00061        ) const;
00062 
00063   ON_BOOL32 Read(
00064          ON_BinaryArchive&  // restore definition from binary archive
00065        );
00066 
00067   ON_wString m_text;
00068 };
00069 
00070 class ON_CLASS ON_AnnotationArrow : public ON_Geometry
00071 {
00072   // 3d annotation arrow
00073   ON_OBJECT_DECLARE(ON_AnnotationArrow);
00074 public:
00075   ON_AnnotationArrow();
00076   ~ON_AnnotationArrow();
00077   ON_AnnotationArrow(const ON_AnnotationArrow&);
00078   ON_AnnotationArrow& operator=(const ON_AnnotationArrow&);
00079 
00081   //
00082   // ON_Object overrides
00083   //
00084 
00085   /*
00086   Description:
00087     Tests an object to see if its data members are correctly
00088     initialized.
00089   Parameters:
00090     text_log - [in] if the object is not valid and text_log
00091         is not NULL, then a brief englis description of the
00092         reason the object is not valid is appened to the log.
00093         The information appended to text_log is suitable for 
00094         low-level debugging purposes by programmers and is 
00095         not intended to be useful as a high level user 
00096         interface tool.
00097   Returns:
00098     @untitled table
00099     true     object is valid
00100     false    object is invalid, uninitialized, etc.
00101   Remarks:
00102     Overrides virtual ON_Object::IsValid
00103   */
00104   ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
00105 
00106   void Dump( ON_TextLog& ) const; // for debugging
00107 
00108   ON_BOOL32 Write(
00109          ON_BinaryArchive&  // serialize definition to binary archive
00110        ) const;
00111 
00112   ON_BOOL32 Read(
00113          ON_BinaryArchive&  // restore definition from binary archive
00114        );
00115 
00116   ON::object_type ObjectType() const;
00117 
00119   //
00120   // ON_Geometry overrides
00121   //
00122 
00123   int Dimension() const;
00124 
00125   // work horse bounding box getter
00126   ON_BOOL32 GetBBox( // returns true if successful
00127          double*,    // boxmin[dim]
00128          double*,    // boxmax[dim]
00129          ON_BOOL32 = false  // true means grow box
00130          ) const;
00131 
00132   ON_BOOL32 Transform( 
00133          const ON_Xform&
00134          );
00135 
00137   //
00138   // Interface
00139   //
00140   ON_3dVector Vector() const;
00141   ON_3dPoint Head() const;
00142   ON_3dPoint Tail() const;
00143 
00144   ON_3dPoint m_tail;
00145   ON_3dPoint m_head;
00146 };
00147 
00149 //
00150 //   ON_Annotation - used to serialize definitions of annotation
00151 //                   objects (dimensions, text blocks, etc.).
00152 //
00153 
00154 class ON_CLASS ON_Annotation : public ON_Geometry
00155 {
00156   ON_OBJECT_DECLARE(ON_Annotation);
00157 
00158   enum SYMBOLS
00159   {
00160     degreesym = 176,
00161     radiussym = 'R',
00162     diametersym = 216,
00163     plusminussym = 177,
00164   };
00165 
00166 
00167 
00168 public:
00169 
00170   virtual ON_BOOL32 IsRealObject() const = 0;
00171 
00172   ON_Annotation();
00173   ON_Annotation(const ON_Annotation&);
00174   ~ON_Annotation();
00175   ON_Annotation& operator=(const ON_Annotation&);
00176 
00177   void Create();  // initialize class's fields assuming
00178                   // memory is uninitialized
00179   void Destroy();
00180   void EmergencyDestroy();
00181 
00183   //
00184   // ON_Object overrides
00185   //
00186 
00187   /*
00188   Description:
00189     Tests an object to see if its data members are correctly
00190     initialized.
00191   Parameters:
00192     text_log - [in] if the object is not valid and text_log
00193         is not NULL, then a brief englis description of the
00194         reason the object is not valid is appened to the log.
00195         The information appended to text_log is suitable for 
00196         low-level debugging purposes by programmers and is 
00197         not intended to be useful as a high level user 
00198         interface tool.
00199   Returns:
00200     @untitled table
00201     true     object is valid
00202     false    object is invalid, uninitialized, etc.
00203   Remarks:
00204     Overrides virtual ON_Object::IsValid
00205   */
00206   ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
00207 
00208   void Dump( ON_TextLog& ) const; // for debugging
00209 
00210   ON_BOOL32 Write(
00211          ON_BinaryArchive&  // serialize definition to binary archive
00212        ) const;
00213 
00214   ON_BOOL32 Read(
00215          ON_BinaryArchive&  // restore definition from binary archive
00216        );
00217 
00218   ON::object_type ObjectType() const;
00219 
00221   //
00222   // ON_Geometry overrides
00223   //
00224 
00225   int Dimension() const;
00226 
00227   ON_BOOL32 GetBBox( // returns true if successful
00228          double*,    // boxmin[dim]
00229          double*,    // boxmax[dim]
00230          ON_BOOL32 = false  // true means grow box
00231          ) const;
00232 
00233   ON_BOOL32 Transform( 
00234          const ON_Xform&
00235          );
00236 
00238   //
00239   // ON_Annotation interface
00240   //
00241 
00242   // use these to get/set the current annotation settings
00243   static const ON_3dmAnnotationSettings& AnnotationSettings();
00244   static void SetAnnotationSettings( const ON_3dmAnnotationSettings* );
00245 
00246   bool IsText() const;
00247   bool IsLeader() const;
00248   bool IsDimension() const;
00249 
00250   virtual double NumericValue() const;
00251   virtual void SetTextToDefault();
00252 
00253   void SetType( ON::eAnnotationType type );
00254   ON::eAnnotationType Type() const;
00255   void SetTextDisplayMode( ON::eTextDisplayMode mode);
00256   ON::eTextDisplayMode TextDisplayMode() const;
00257 
00258   void SetPlane( const ON_Plane& plane );
00259   ON_Plane Plane() const;
00260   int PointCount() const;
00261   void SetPoints( const ON_SimpleArray<ON_2dPoint>& points );
00262   const ON_SimpleArray<ON_2dPoint>& Points() const;
00263   void SetPoint( int idx, ON_3dPoint point );
00264   ON_2dPoint Point( int idx ) const;
00265   void SetUserText( const wchar_t* string );
00266   const ON_wString& UserText() const;
00267   void SetDefaultText( const wchar_t* string );
00268   const ON_wString& DefaultText() const;
00269   void SetUserPositionedText( int bUserPositionedText );
00270   bool UserPositionedText() const;
00271 
00272   // to convert world 3d points to and from annotation 2d points
00273   bool GetECStoWCSXform( ON_Xform& xform ) const;
00274   bool GeWCStoECSXform( ON_Xform& xform ) const;
00275 
00276   ON::eAnnotationType m_type;          // enum for type of annotation
00277                                        // DimLinear, DimRadius, etc.
00278 
00279   ON::eTextDisplayMode m_textdisplaymode; // how the text is displayed
00280                                        // Horizontal, InLine, AboveLine
00281 
00282   ON_Plane m_plane;                    // ECS reference plane in WCS coordinates
00283   ON_SimpleArray<ON_2dPoint> m_points; // Definition points for the dimension
00284 
00285   ON_wString m_usertext;               // "<>", or user override
00286   ON_wString m_defaulttext;            // The displayed text string
00287 
00288   bool m_userpositionedtext;           // true: User has positioned text 
00289                                        // false: use default location
00290 };
00291 
00292 
00293 class ON_CLASS ON_LinearDimension : public ON_Annotation
00294 {
00295   ON_OBJECT_DECLARE(ON_LinearDimension);
00296 
00297 public:
00298   ON_BOOL32 IsRealObject() const;
00299   ON_LinearDimension();
00300   ON_LinearDimension(const ON_LinearDimension&);
00301   ~ON_LinearDimension();
00302   ON_LinearDimension& operator=(const ON_LinearDimension&);
00303 
00304   double NumericValue();
00305   void SetTextToDefault();
00306   void EmergencyDestroy();
00307 };
00308 
00309 class ON_CLASS ON_RadialDimension : public ON_Annotation
00310 {
00311   ON_OBJECT_DECLARE(ON_RadialDimension);
00312 
00313 public:
00314   ON_BOOL32 IsRealObject() const;
00315   ON_RadialDimension();
00316   ON_RadialDimension(const ON_RadialDimension&);
00317   ~ON_RadialDimension();
00318   ON_RadialDimension& operator=(const ON_RadialDimension&);
00319 
00320   double NumericValue();
00321   void SetTextToDefault();
00322 
00323   void EmergencyDestroy();
00324 };
00325 
00326 class ON_CLASS ON_AngularDimension : public ON_Annotation
00327 {
00328   ON_OBJECT_DECLARE(ON_AngularDimension);
00329 
00330 public:
00331   ON_BOOL32 IsRealObject() const;
00332 
00333   ON_AngularDimension();
00334   ON_AngularDimension(const ON_AngularDimension&);
00335   ~ON_AngularDimension();
00336   ON_AngularDimension& operator=(const ON_AngularDimension&);
00337 
00338   void EmergencyDestroy();
00339 
00340   ON_BOOL32 Write( ON_BinaryArchive& file ) const;
00341   ON_BOOL32 Read( ON_BinaryArchive& file );
00342 
00343   void SetAngle( double angle ) { m_angle = angle; }
00344   double Angle() const { return m_angle; }
00345   void SetRadius( double radius ) { m_radius = radius; }
00346   double Radius() const { return m_radius; }
00347 
00348   double NumericValue();
00349   void SetTextToDefault();
00350 
00351 
00352 private:
00353   double m_angle;      // angle being dimensioned
00354   double m_radius;     // radius for dimension arc
00355 };
00356 
00357 class ON_CLASS ON_TextEntity : public ON_Annotation
00358 {
00359   ON_OBJECT_DECLARE(ON_TextEntity);
00360 
00361 public:
00362   ON_BOOL32 IsRealObject() const;
00363   ON_TextEntity();
00364   ON_TextEntity(const ON_TextEntity&);
00365   ~ON_TextEntity();
00366   ON_TextEntity& operator=(const ON_TextEntity&);
00367 
00368   void EmergencyDestroy();
00369 
00370   ON_BOOL32 Write( ON_BinaryArchive& file ) const;
00371   ON_BOOL32 Read( ON_BinaryArchive& file );
00372 
00373   void SetFaceName( ON_wString string ) { m_facename = string; }
00374   ON_wString FaceName() const { return m_facename; }
00375   void SetFontWeight( int weight ) { m_fontweight = weight; }
00376   int FontWeight() const { return m_fontweight; }
00377   void SetHeight( double height ) { m_height = height; }
00378   double Height() const { return m_height; }
00379 
00380 private:
00381   ON_wString m_facename;
00382   int m_fontweight;  // windows - 400 = NORMAL )
00383   double m_height;   // gets multiplied by dimscale
00384 };
00385 
00386 class ON_CLASS ON_Leader : public ON_Annotation
00387 {
00388   ON_OBJECT_DECLARE(ON_Leader);
00389 
00390 public:
00391   ON_BOOL32 IsRealObject() const;
00392   ON_Leader();
00393   ON_Leader(const ON_Leader&);
00394   ~ON_Leader();
00395   ON_Leader& operator=(const ON_Leader&);
00396 
00397   void EmergencyDestroy();
00398 };
00399 
00400 
00401 
00402 
00403 #endif
00404 


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:26:58