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

ellipse.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 ELLIPSE_HEADER
00019 #define ELLIPSE_HEADER
00020 
00021 #include "whiptk/whipcore.h"
00022 #include "whiptk/file.h"
00023 #include "whiptk/drawable.h"
00024 
00026 class WHIPTK_API WT_Ellipse : public WT_Drawable
00027 {
00028 protected:
00029     WT_Logical_Point        m_position; 
00030     WT_Integer32            m_major; 
00031     WT_Integer32            m_minor; 
00032     WT_Unsigned_Integer16   m_start; 
00033     WT_Unsigned_Integer32   m_end; 
00034     WT_Unsigned_Integer16   m_tilt; 
00036 
00037     enum WT_Materialize_Stage
00038     {
00039         Get_Position,
00040         Get_Major,
00041         Get_Minor,
00042         Get_Start,
00043         Get_End,
00044         Get_Tilt,
00045         Get_Close_Paren,
00046         Completed
00047     }                       m_stage;
00048 
00049     WT_Boolean              m_transformed; 
00051 public:
00052 
00054     WT_Ellipse ()
00055         : m_major(0)
00056         , m_minor(0)
00057         , m_start(0)
00058         , m_end(0x00010000)
00059         , m_tilt(0)
00060         , m_stage (Get_Position)
00061         , m_transformed (WD_False)
00062     {}
00063 
00065     WT_Ellipse(
00066         WT_Integer32            x,  
00067         WT_Integer32            y,  
00068         WT_Integer32            major, 
00069         WT_Integer32            minor, 
00070         WT_Unsigned_Integer16   start   = 0, 
00071         WT_Unsigned_Integer16   end     = 0, 
00072         WT_Unsigned_Integer16   tilt    = 0 
00073         )
00074         : m_position (WT_Logical_Point (x, y))
00075         , m_major (major)
00076         , m_minor (minor)
00077         , m_start (start)
00078         , m_end (end)
00079         , m_tilt (tilt)
00080         , m_stage (Completed)
00081         , m_transformed (WD_False)
00082     {
00083         if (m_end <= m_start)
00084             m_end += 0x00010000;
00085     }
00086 
00088     WT_Ellipse(
00089         WT_Logical_Point const &  pos,  
00090         WT_Integer32            major, 
00091         WT_Integer32            minor, 
00092         WT_Unsigned_Integer16   start   = 0, 
00093         WT_Unsigned_Integer16   end     = 0, 
00094         WT_Unsigned_Integer16   tilt    = 0 
00095         )
00096         : m_position (pos)
00097         , m_major (major)
00098         , m_minor (minor)
00099         , m_start (start)
00100         , m_end (end)
00101         , m_tilt (tilt)
00102         , m_stage (Completed)
00103         , m_transformed (WD_False)
00104     {
00105         if (m_end <= m_start)
00106             m_end += 0x00010000;
00107     }
00108 
00110     ~WT_Ellipse()
00111     { }
00112 
00114 
00115     WT_Integer32 major() const
00116     {   return m_major;     }
00117 
00119     WT_Integer32 minor() const
00120     {   return m_minor;     }
00121 
00123     WT_Logical_Point position() const
00124     {   return m_position;  }
00125 
00127     WT_Unsigned_Integer16 start() const
00128     {   return m_start;     }
00129 
00131     float start_degree() const
00132     {   return ((float)m_start / (float)0x00010000);     }
00133 
00135     float start_radian() const
00136     {   return (float) (start_degree() * TWO_PI);     }
00137 
00139     WT_Unsigned_Integer32 end() const
00140     {   return m_end;       }
00141 
00143     float end_degree() const
00144     {   return ((float)m_end   / (float)0x00010000);    }
00145 
00147     float end_radian() const
00148     {   return (float) (end_degree()   * TWO_PI);     }
00149 
00151     WT_Unsigned_Integer16 tilt() const
00152     {   return m_tilt;       }
00153 
00155     float tilt_degree() const
00156     {   return ((float) tilt() / (float)0x00010000);    }
00157 
00159     float tilt_radian() const
00160     {   return (float) (tilt_degree() * TWO_PI);    }
00162 
00164     WT_Result    materialize(WT_Opcode const & opcode, WT_File & file);
00165     WT_Result    skip_operand(WT_Opcode const & opcode, WT_File & file);
00166     virtual void update_bounds(WT_File * file);
00168 
00170     void         transform(WT_Transform const & transform);
00171 
00172 protected:
00174     WT_Result    serialize(WT_File & file, WT_Boolean filled) const;
00175 
00176 };
00177 
00178 
00183 
00184 
00187 class WHIPTK_API WT_Filled_Ellipse : public WT_Ellipse
00188 {
00189 public:
00190 
00192     WT_Filled_Ellipse()
00193     { }
00194 
00196     WT_Filled_Ellipse (
00197         WT_Integer32            x,  
00198         WT_Integer32            y,  
00199         WT_Integer32            major, 
00200         WT_Integer32            minor, 
00201         WT_Unsigned_Integer16   start   = 0, 
00202         WT_Unsigned_Integer16   end     = 0, 
00203         WT_Unsigned_Integer16   tilt    = 0 
00204         )
00205         : WT_Ellipse (x, y, major, minor, start, end, tilt)
00206     { }
00207 
00209     WT_Filled_Ellipse(
00210         WT_Logical_Point const &  pos,  
00211         WT_Integer32            major, 
00212         WT_Integer32            minor, 
00213         WT_Unsigned_Integer16   start   = 0, 
00214         WT_Unsigned_Integer16   end     = 0, 
00215         WT_Unsigned_Integer16   tilt    = 0 
00216         )
00217         : WT_Ellipse (pos, major, minor, start, end, tilt)
00218     { }
00219 
00221     WT_ID            object_id() const;
00222     WT_Result        serialize(WT_File & file) const;
00223     WT_Result        process(WT_File & file);
00225 
00227 
00229     static WT_Result default_process(
00230         WT_Filled_Ellipse & item, 
00231         WT_File & file 
00232         );
00233 };
00234 
00236 
00239 class WHIPTK_API WT_Outline_Ellipse : public WT_Ellipse
00240 {
00241 public:
00242 
00244     WT_Outline_Ellipse ()
00245     { }
00246 
00248     WT_Outline_Ellipse (
00249         WT_Integer32            x,  
00250         WT_Integer32            y,  
00251         WT_Integer32            major, 
00252         WT_Integer32            minor, 
00253         WT_Unsigned_Integer16   start   = 0, 
00254         WT_Unsigned_Integer16   end     = 0, 
00255         WT_Unsigned_Integer16   tilt    = 0 
00256         )
00257         : WT_Ellipse (x, y, major, minor, start, end, tilt)
00258     { }
00259 
00261     WT_Outline_Ellipse(
00262         WT_Logical_Point const &  pos,  
00263         WT_Integer32            major, 
00264         WT_Integer32            minor, 
00265         WT_Unsigned_Integer16   start   = 0, 
00266         WT_Unsigned_Integer16   end     = 0, 
00267         WT_Unsigned_Integer16   tilt    = 0 
00268         )
00269         : WT_Ellipse (pos, major, minor, start, end, tilt)
00270     { }
00271 
00273     WT_ID            object_id() const;
00274     WT_Result        serialize(WT_File & file) const;
00275     WT_Result        process(WT_File & file);
00277 
00279 
00281     static WT_Result default_process(
00282         WT_Outline_Ellipse & item, 
00283         WT_File & file 
00284         );
00285 };
00286 
00288 
00289 #endif // ELLIPSE_HEADER

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