Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages | Examples

units.h

00001 //  Copyright (c) 1996-2001 by Autodesk, Inc.
00002 //
00003 //  By using this code, you are agreeing to the terms and conditions of
00004 //  the License Agreement included in the documentation for this code.
00005 //
00006 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
00007 //  OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
00008 //  PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
00009 //  LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00010 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00011 //
00012 //  Use, duplication, or disclosure by the U.S. Government is subject to
00013 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00014 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00015 //  Data and Computer Software), as applicable.
00016 //
00017 
00018 #if !defined UNITS_HEADER
00019 #define UNITS_HEADER
00020 
00021 #include "whiptk/whipcore.h"
00022 #include "whiptk/matrix.h"
00023 #include "whiptk/object.h"
00024 
00025 class WT_File;
00026 
00030 
00031 class WHIPTK_API WT_Units : public WT_Object
00032 {
00033 
00034 private:
00035     WT_Matrix         m_transform;
00036     WT_Matrix           m_adjoint;
00037     WT_String           m_units;
00038     WT_Boolean          m_adjoint_valid;
00039 
00040     enum
00041     {
00042         Eating_Initial_Whitespace,
00043         Getting_Units_String,
00044         Getting_Transform,
00045         Getting_Close_Paren
00046     }                   m_stage;
00047 
00048 public:
00049 
00051 
00052     WT_Units()
00053         : m_adjoint_valid(WD_False)
00054         , m_stage(Eating_Initial_Whitespace)
00055     { }
00056 
00058     WT_Units(
00059         WT_Matrix const & xform, 
00060         WT_String units 
00061         )
00062         : m_transform(xform)
00063         , m_units(units)
00064         , m_adjoint_valid(WD_False)
00065         , m_stage(Eating_Initial_Whitespace)
00066     { }
00067 
00069 
00070     WT_Matrix const &  application_to_dwf_transform() const    {   return m_transform;    }
00072     WT_Matrix const &  dwf_to_application_adjoint_transform();
00074     void               set_application_to_dwf_transform(WT_Matrix const & xform);
00076 
00088     void               set_units(WT_String const & units)      {   m_units = units;       }
00090 
00102     void               set_units(int length, WT_Unsigned_Integer16 const * units);
00104     WT_String const &  units() const                           {   return m_units;        }
00106 
00108 
00109     WT_Point3D         transform(WT_Logical_Point const & in_pt);
00111     WT_Logical_Point   transform(WT_Point3D const & in_pt) const;
00113     WT_Point3D         transform_from_DWF_to_application(WT_Point3D const & in_pt);
00115     WT_Point3D         transform_from_application_to_DWF(WT_Point3D const & in_pt) const;
00117 
00119     WT_Boolean                      operator==(WT_Units const &) const;
00121     WT_Boolean                      operator!=(WT_Units const & u) const    {   return !((*this)==u);  }
00122 
00124     WT_Result          materialize(WT_Opcode const & opcode, WT_File & file);
00125     WT_Object::WT_ID   object_id() const;
00126     WT_Object::WT_Type object_type() const;
00127     WT_Result          process(WT_File & file);
00128     WT_Result          serialize(WT_File & file) const;
00129     WT_Result          skip_operand(WT_Opcode const & opcode, WT_File & file);
00131 
00133 
00135     static WT_Result default_process(
00136         WT_Units & item, 
00137         WT_File & file 
00138         );
00139 
00140 };
00143 #endif // UNITS_HEADER

Generated on Tue May 17 12:07:44 2005 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.1