units.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 1996-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00008 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00009 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00010 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00011 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00012 //
00013 //  Use, duplication, or disclosure by the U.S. Government is subject to
00014 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00015 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00016 //  Data and Computer Software), as applicable.
00017 //
00018 
00019 #if !defined UNITS_HEADER
00020 #define UNITS_HEADER
00021 
00025 
00026 #include "whiptk/whipcore.h"
00027 #include "whiptk/matrix.h"
00028 #include "whiptk/object.h"
00029 
00030 class WT_File;
00031 
00035 
00036 class WHIPTK_API WT_Units : public WT_Object
00037 {
00038         friend class WT_Drawing_Info;
00039         friend class WT_W2D_Class_Factory;
00040         friend class WT_Opcode;
00041 
00042 private:
00043     WT_Matrix      m_transform;
00044     WT_Matrix      m_adjoint;
00045     WT_String           m_units;
00046     WT_Boolean          m_adjoint_valid;
00047 
00048     enum
00049     {
00050         Eating_Initial_Whitespace,
00051         Getting_Units_String,
00052         Getting_Transform,
00053         Getting_Close_Paren
00054     }                   m_stage;
00055 
00056 public:
00057 
00059 
00060     WT_Units()
00061         : m_adjoint_valid(WD_False)
00062         , m_stage(Eating_Initial_Whitespace)
00063     { }
00064 
00066     WT_Units(
00067         WT_Matrix const & xform, 
00068         WT_String units 
00069         )
00070         : m_transform(xform)
00071         , m_units(units)
00072         , m_adjoint_valid(WD_False)
00073         , m_stage(Eating_Initial_Whitespace)
00074     { }
00075 
00077         WT_Units(WT_Units const& units)
00078         {
00079                 *this = units;
00080         }
00081 
00082         virtual ~WT_Units()
00083         {}
00084 public:
00086 
00087     WT_Matrix const &  application_to_dwf_transform() const    {   return m_transform;    }
00089     WT_Matrix const &  dwf_to_application_adjoint_transform();
00091     void               set_application_to_dwf_transform(WT_Matrix const & xform);
00093 
00105     void               set_units(WT_String const & units)      {   m_units = units;       }
00107 
00119     void               set_units(int length, WT_Unsigned_Integer16 const * units);
00121     WT_String const &  units() const                           {   return m_units;        }
00123 
00125 
00126     WT_Point3D         transform(WT_Logical_Point const & in_pt);
00128     WT_Logical_Point   transform(WT_Point3D const & in_pt) const;
00130     WT_Point3D         transform_from_DWF_to_application(WT_Point3D const & in_pt);
00132     WT_Point3D         transform_from_application_to_DWF(WT_Point3D const & in_pt) const;
00134 
00136     WT_Boolean                      operator==(WT_Units const &) const;
00138     WT_Boolean                      operator!=(WT_Units const & u) const    {   return !((*this)==u);  }
00139 
00141     WT_Result          materialize(WT_Opcode const & opcode, WT_File & file);
00142     WT_Object::WT_ID   object_id() const;
00143     WT_Object::WT_Type object_type() const;
00144     WT_Result          process(WT_File & file);
00145     WT_Result          serialize(WT_File & file) const;
00146     WT_Result          skip_operand(WT_Opcode const & opcode, WT_File & file);
00148 
00150 
00152     static WT_Result default_process(
00153         WT_Units & item, 
00154         WT_File & file 
00155         );
00156 
00157 };
00160 #endif // UNITS_HEADER

Generated on Tue Jan 6 22:41:13 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5