ellipse.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 ELLIPSE_HEADER
00020 #define ELLIPSE_HEADER
00021 
00025 
00026 #include "whiptk/whipcore.h"
00027 #include "whiptk/file.h"
00028 #include "whiptk/drawable.h"
00029 
00031 class WHIPTK_API WT_Ellipse : public WT_Drawable
00032 {
00033 protected:
00034     WT_Logical_Point        m_position; 
00035     WT_Integer32            m_major; 
00036     WT_Integer32            m_minor; 
00037     WT_Unsigned_Integer16   m_start; 
00038     WT_Unsigned_Integer32   m_end; 
00039     WT_Unsigned_Integer16   m_tilt; 
00041 
00042     enum WT_Materialize_Stage
00043     {
00044         Get_Position,
00045         Get_Major,
00046         Get_Minor,
00047         Get_Start,
00048         Get_End,
00049         Get_Tilt,
00050         Get_Close_Paren,
00051         Completed
00052     }                       m_stage;
00053 
00054     WT_Boolean              m_transformed; 
00056 protected:
00057 
00059     WT_Ellipse ()
00060         : m_major(0)
00061         , m_minor(0)
00062         , m_start(0)
00063         , m_end(0x00010000)
00064         , m_tilt(0)
00065         , m_stage (Get_Position)
00066         , m_transformed (WD_False)
00067     {}
00068 
00070     WT_Ellipse(
00071         WT_Integer32            x,  
00072         WT_Integer32            y,  
00073         WT_Integer32            major, 
00074         WT_Integer32            minor, 
00075         WT_Unsigned_Integer16   start   = 0, 
00076         WT_Unsigned_Integer16   end     = 0, 
00077         WT_Unsigned_Integer16   tilt    = 0 
00078         )
00079         : m_position (WT_Logical_Point (x, y))
00080         , m_major (major)
00081         , m_minor (minor)
00082         , m_start (start)
00083         , m_end (end)
00084         , m_tilt (tilt)
00085         , m_stage (Completed)
00086         , m_transformed (WD_False)
00087     {
00088         if (m_end <= m_start)
00089             m_end += 0x00010000;
00090     }
00091 
00093     WT_Ellipse(
00094         WT_Logical_Point const &  pos,  
00095         WT_Integer32            major, 
00096         WT_Integer32            minor, 
00097         WT_Unsigned_Integer16   start   = 0, 
00098         WT_Unsigned_Integer16   end     = 0, 
00099         WT_Unsigned_Integer16   tilt    = 0 
00100         )
00101         : m_position (pos)
00102         , m_major (major)
00103         , m_minor (minor)
00104         , m_start (start)
00105         , m_end (end)
00106         , m_tilt (tilt)
00107         , m_stage (Completed)
00108         , m_transformed (WD_False)
00109     {
00110         if (m_end <= m_start)
00111             m_end += 0x00010000;
00112     }
00113 
00114         WT_Ellipse(const WT_Ellipse& e)
00115         {
00116                 *this = e;
00117         }
00118                 
00119 
00121     virtual ~WT_Ellipse()
00122     { }
00123 
00124 public:
00126 
00127     const WT_Integer32& major() const   { return m_major; }
00128           WT_Integer32& major()         { return m_major; }
00129 
00131     const WT_Integer32& minor() const   { return m_minor; }
00132           WT_Integer32& minor()         { return m_minor; }
00133 
00135     const WT_Logical_Point& position() const { return m_position; }
00136           WT_Logical_Point& position()       { return m_position; }
00137 
00139     const WT_Unsigned_Integer16& start() const { return m_start; }
00140           WT_Unsigned_Integer16& start()       { return m_start; }
00141 
00143     float start_degree() const
00144     {
00145         return ((float)(m_start * 360.0) / (float)0x00010000);
00146     }
00147 
00149     float start_radian() const
00150     {
00151         return ((float)(m_start * TWO_PI) / (float)0x00010000);
00152     }
00153 
00155     const WT_Unsigned_Integer32& end() const { return m_end; }
00156           WT_Unsigned_Integer32& end()       { return m_end; }
00157 
00159     float end_degree() const
00160     {
00161         return ((float)(m_end * 360.0) / (float)0x00010000);
00162     }
00163 
00165     float end_radian() const
00166     {
00167         return ((float)(m_end * TWO_PI) / (float)0x00010000);
00168     }
00169 
00171     const WT_Unsigned_Integer16& tilt() const { return m_tilt; }
00172           WT_Unsigned_Integer16& tilt()       { return m_tilt; }
00173 
00175     float tilt_degree() const
00176     {
00177         return ((float)(m_tilt * 360.0) / (float)0x00010000);
00178     }
00179 
00181     float tilt_radian() const
00182     {
00183         return ((float)(m_tilt * TWO_PI) / (float)0x00010000);
00184     }
00185 
00186         WT_Boolean transformed() const
00187         {
00188                 return m_transformed;
00189         }
00191 
00193     WT_Result    materialize(WT_Opcode const & opcode, WT_File & file);
00194     WT_Result    skip_operand(WT_Opcode const & opcode, WT_File & file);
00195     virtual void update_bounds(WT_File * file);
00197 
00199     void         transform(WT_Transform const & transform);
00200 
00201 protected:
00203     WT_Result    serialize(WT_File & file, WT_Boolean filled) const;
00204 
00205 };
00206 
00207 
00212 
00213 
00216 class WHIPTK_API WT_Filled_Ellipse : public WT_Ellipse
00217 {
00218         friend class WT_W2D_Class_Factory;
00219         friend class WT_Opcode;
00220         
00221 public:
00222 
00224     WT_Filled_Ellipse()
00225     { }
00226 
00228     WT_Filled_Ellipse (
00229         WT_Integer32            x,  
00230         WT_Integer32            y,  
00231         WT_Integer32            major, 
00232         WT_Integer32            minor, 
00233         WT_Unsigned_Integer16   start   = 0, 
00234         WT_Unsigned_Integer16   end     = 0, 
00235         WT_Unsigned_Integer16   tilt    = 0 
00236         )
00237         : WT_Ellipse (x, y, major, minor, start, end, tilt)
00238     { }
00239 
00241     WT_Filled_Ellipse(
00242         WT_Logical_Point const &  pos,  
00243         WT_Integer32            major, 
00244         WT_Integer32            minor, 
00245         WT_Unsigned_Integer16   start   = 0, 
00246         WT_Unsigned_Integer16   end     = 0, 
00247         WT_Unsigned_Integer16   tilt    = 0 
00248         )
00249         : WT_Ellipse (pos, major, minor, start, end, tilt)
00250     { }
00251 
00252         virtual ~WT_Filled_Ellipse()
00253         {}
00254 public:
00256     WT_ID            object_id() const;
00257     WT_Result        serialize(WT_File & file) const;
00258     WT_Result        process(WT_File & file);
00260 
00262 
00264     static WT_Result default_process(
00265         WT_Filled_Ellipse & item, 
00266         WT_File & file 
00267         );
00268 };
00269 
00271 
00274 class WHIPTK_API WT_Outline_Ellipse : public WT_Ellipse
00275 {
00276         friend class WT_W2D_Class_Factory;
00277         friend class WT_Opcode;
00278 
00279 public:
00280 
00282     WT_Outline_Ellipse ()
00283     { }
00284 
00286     WT_Outline_Ellipse (
00287         WT_Integer32            x,  
00288         WT_Integer32            y,  
00289         WT_Integer32            major, 
00290         WT_Integer32            minor, 
00291         WT_Unsigned_Integer16   start   = 0, 
00292         WT_Unsigned_Integer16   end     = 0, 
00293         WT_Unsigned_Integer16   tilt    = 0 
00294         )
00295         : WT_Ellipse (x, y, major, minor, start, end, tilt)
00296     { }
00297 
00299     WT_Outline_Ellipse(
00300         WT_Logical_Point const &  pos,  
00301         WT_Integer32            major, 
00302         WT_Integer32            minor, 
00303         WT_Unsigned_Integer16   start   = 0, 
00304         WT_Unsigned_Integer16   end     = 0, 
00305         WT_Unsigned_Integer16   tilt    = 0 
00306         )
00307         : WT_Ellipse (pos, major, minor, start, end, tilt)
00308     { }
00309         virtual ~WT_Outline_Ellipse()
00310         {}
00311 public:
00313     WT_ID            object_id() const;
00314     WT_Result        serialize(WT_File & file) const;
00315     WT_Result        process(WT_File & file);
00317 
00319 
00321     static WT_Result default_process(
00322         WT_Outline_Ellipse & item, 
00323         WT_File & file 
00324         );
00325 };
00326 
00328 
00329 #endif // ELLIPSE_HEADER

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