rendition.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 RENDITION_HEADER
00020 #define RENDITION_HEADER
00021 
00025 
00026 #include "whiptk/whipcore.h"
00027 #include "whiptk/rendopts.h"
00028 #include "whiptk/dwginfo.h"
00029 #include "whiptk/color.h"
00030 #include "whiptk/colormap.h"
00031 #include "whiptk/backgrnd.h"
00032 #include "whiptk/fill.h"
00033 #include "whiptk/view.h"
00034 #include "whiptk/viewport.h"
00035 #include "whiptk/visible.h"
00036 #include "whiptk/lweight.h"
00037 #include "whiptk/marksize.h"
00038 #include "whiptk/marksymb.h"
00039 #include "whiptk/projection.h"
00040 #include "whiptk/url.h"
00041 #include "whiptk/layer.h"
00042 #include "whiptk/object_node.h"
00043 #include "whiptk/font.h"
00044 #include "whiptk/code_page.h"
00045 #include "whiptk/linepat.h"
00046 #include "whiptk/dashpat.h"
00047 #include "whiptk/linestyle.h"
00048 #include "whiptk/plotinfo.h"
00049 #include "whiptk/merge_control.h"
00050 #include "whiptk/font_extension.h"
00051 #include "whiptk/plot_optimized.h"
00052 #include "whiptk/fillpat.h"
00053 #include "whiptk/blockref.h"
00054 #include "whiptk/penpat.h"
00055 #include "whiptk/delineate.h"
00056 #include "whiptk/macro_scale.h"
00057 #include "whiptk/macro_index.h"
00058 #include "whiptk/text_background.h"
00059 #include "whiptk/text_halign.h"
00060 #include "whiptk/text_valign.h"
00061 #include "whiptk/usrfillpat.h"
00062 #include "whiptk/usrhatchpat.h"
00063 #include "whiptk/contrastcolor.h"
00064 #include "whiptk/attribute_url.h"
00065 
00066 // IMP. Attributes Marker_Size and Marker_Symbol have been deprecated and are only supported for
00067 //      W2D files lower then version 601
00068 
00069 #define WHIP_ATTRIBUTE_LIST \
00070     WHIP_ATTRIBUTE_MACRO(Attribute_URL,attribute_url)\
00071     WHIP_ATTRIBUTE_MACRO(BlockRef,blockref)\
00072     WHIP_ATTRIBUTE_MACRO(Code_Page,code_page)\
00073     WHIP_ATTRIBUTE_MACRO(Color,color)\
00074     WHIP_ATTRIBUTE_MACRO(Color_Map,color_map)\
00075     WHIP_ATTRIBUTE_MACRO(Contrast_Color,contrast_color)\
00076     WHIP_ATTRIBUTE_MACRO(Dash_Pattern,dash_pattern)\
00077     WHIP_ATTRIBUTE_MACRO(Delineate,delineate)\
00078     WHIP_ATTRIBUTE_MACRO(Fill,fill)\
00079     WHIP_ATTRIBUTE_MACRO(Fill_Pattern,fill_pattern)\
00080     WHIP_ATTRIBUTE_MACRO(Font,font)\
00081     WHIP_ATTRIBUTE_MACRO(Font_Extension,font_extension)\
00082     WHIP_ATTRIBUTE_MACRO(Layer,layer)\
00083     WHIP_ATTRIBUTE_MACRO(Line_Pattern,line_pattern)\
00084     WHIP_ATTRIBUTE_MACRO(Line_Style,line_style)\
00085     WHIP_ATTRIBUTE_MACRO(Line_Weight,line_weight)\
00086     WHIP_ATTRIBUTE_MACRO(Macro_Scale,macro_scale)\
00087     WHIP_ATTRIBUTE_MACRO(Macro_Index,macro_index)\
00088     WHIP_ATTRIBUTE_MACRO(Marker_Size,marker_size)\
00089     WHIP_ATTRIBUTE_MACRO(Marker_Symbol,marker_symbol)\
00090     WHIP_ATTRIBUTE_MACRO(Merge_Control,merge_control)\
00091     WHIP_ATTRIBUTE_MACRO(Object_Node,object_node)\
00092     WHIP_ATTRIBUTE_MACRO(Pen_Pattern,pen_pattern)\
00093     WHIP_ATTRIBUTE_MACRO(Projection,projection)\
00094     WHIP_ATTRIBUTE_MACRO(User_Fill_Pattern,user_fill_pattern)\
00095     WHIP_ATTRIBUTE_MACRO(User_Hatch_Pattern,user_hatch_pattern)\
00096     WHIP_ATTRIBUTE_MACRO(Text_Background,text_background)\
00097     WHIP_ATTRIBUTE_MACRO(Text_HAlign,text_halign)\
00098     WHIP_ATTRIBUTE_MACRO(Text_VAlign,text_valign)\
00099     WHIP_ATTRIBUTE_MACRO(URL,url)\
00100     WHIP_ATTRIBUTE_MACRO(Viewport,viewport)\
00101     WHIP_ATTRIBUTE_MACRO(Visibility,visibility)
00102 
00103 
00116 
00117 
00121 class WHIPTK_API WT_Rendition
00122 {
00123 protected:
00124     WT_Integer32            m_changed_flags;    
00125 
00126 protected:
00127     WT_Rendering_Options    m_rendering_options;
00128     WT_Drawing_Info         m_drawing_info;
00129     WT_Plot_Info            m_plot_info;
00130     WT_URL_List             m_url_lookup_list;
00131 
00132     WT_Result sync_parts(WT_File & file, WT_Integer32 needed);
00133 
00134 #define WHIP_ATTRIBUTE_MACRO(class_name, class_lower) \
00135     WT_##class_name            m_##class_lower;
00136     WHIP_ATTRIBUTE_LIST
00137 #undef WHIP_ATTRIBUTE_MACRO
00138 
00139 public:
00141     enum WT_Attribute_Bits
00142     {
00143         // For speed's sake, these should be ordered from most oftenly changed
00144         // to least oftenly changed...
00145         Color_Bit              = 0x00000001,
00146         Fill_Bit               = 0x00000002,
00147         Visibility_Bit         = 0x00000004,
00148         URL_Bit                = 0x00000008,
00149         Line_Weight_Bit        = 0x00000010,
00150         Line_Style_Bit         = 0x00000020,
00151         Macro_Scale_Bit        = 0x00000040,    // IMP. This Bit is shared by WT_Marker_Size ( version < 601) and WT_Macro_Size ( version => 601)
00152         Marker_Size_Bit        = 0x00000040,
00153         Macro_Index_Bit        = 0x00000080,    // IMP. This Bit is shared by WT_Marker_Symbol ( version < 601) and WT_Macro_Index ( version => 601)    
00154         Marker_Symbol_Bit      = 0x00000080,
00155         Layer_Bit              = 0x00000100,    
00156         Color_Map_Bit          = 0x00000200,
00157         Line_Pattern_Bit       = 0x00000400,
00158         Projection_Bit         = 0x00000800,
00159         Font_Bit               = 0x00001000,
00160         Viewport_Bit           = 0x00002000,
00161         Code_Page_Bit          = 0x00004000,
00162         Dash_Pattern_Bit       = 0x00008000,
00163         Fill_Pattern_Bit       = 0x00010000,
00164         Merge_Control_Bit      = 0x00020000,
00165         BlockRef_Bit           = 0x00040000,
00166         Pen_Pattern_Bit        = 0x00080000,
00167         Font_Extension_Bit     = 0x00100000,
00168         Object_Node_Bit        = 0x00200000,
00169         Text_Background_Bit    = 0x00400000,
00170         Text_HAlign_Bit        = 0x00800000,
00171         Text_VAlign_Bit        = 0x01000000,
00172         Delineate_Bit          = 0x02000000,
00173         User_Fill_Pattern_Bit  = 0x04000000,
00174         User_Hatch_Pattern_Bit = 0x08000000,
00175         Contrast_Color_Bit     = 0x10000000,
00176         Attribute_URL_Bit      = 0x20000000
00177     };
00178 public:
00180     WT_Rendition()
00181         : m_changed_flags(0)
00182         , m_color_map() // Normally we need to specify which version of the default colormap we want, but we don't yet know what version file we'll be reading.
00183     { }
00184 
00186     WT_Rendition (WT_Rendition const & other)
00187         : m_changed_flags     (other.m_changed_flags)
00188         , m_rendering_options (other.m_rendering_options)
00189         , m_drawing_info      (other.m_drawing_info)
00190         , m_plot_info         (other.m_plot_info)
00191         , m_url_lookup_list   (other.m_url_lookup_list)
00192     #define WHIP_ATTRIBUTE_MACRO(class_name, class_lower) \
00193         , m_##class_lower (other.m_##class_lower)
00194         WHIP_ATTRIBUTE_LIST
00195     #undef WHIP_ATTRIBUTE_MACRO
00196     {
00197         ;
00198     }
00199 
00201     virtual ~WT_Rendition()
00202     { }
00203 
00205     WT_Rendition & operator= (WT_Rendition const & other)
00206     {
00207         m_changed_flags     = other.m_changed_flags; //
00208         m_rendering_options = other.m_rendering_options;
00209         m_drawing_info      = other.m_drawing_info;
00210         m_plot_info         = other.m_plot_info;
00211         m_url_lookup_list   = other.m_url_lookup_list;
00212 
00213         #define WHIP_ATTRIBUTE_MACRO(class_name, class_lower) \
00214             m_##class_lower = other.m_##class_lower;
00215             WHIP_ATTRIBUTE_LIST
00216         #undef WHIP_ATTRIBUTE_MACRO
00217 
00218         return *this;
00219     }
00220 
00221     
00222 
00224 
00225     virtual WT_Drawing_Info & drawing_info()
00226     {   return m_drawing_info; }
00227 
00229     virtual WT_Rendering_Options & rendering_options()
00230     {   return m_rendering_options; }
00231 
00233     virtual WT_Plot_Info & plot_info()
00234     {   return m_plot_info; }
00235 
00237     virtual WT_URL_List  & url_lookup_list()
00238     {   return m_url_lookup_list; }
00240 
00246     #define WHIP_ATTRIBUTE_MACRO(class_name, class_lower) \
00247         virtual WT_##class_name const & class_lower()    const { return m_##class_lower; }
00248         WHIP_ATTRIBUTE_LIST
00249     #undef WHIP_ATTRIBUTE_MACRO
00250 
00251 
00257     #define WHIP_ATTRIBUTE_MACRO(class_name, class_lower) \
00258         virtual WT_##class_name & class_lower() { m_changed_flags |= class_name##_Bit; return m_##class_lower; }
00259         WHIP_ATTRIBUTE_LIST
00260     #undef WHIP_ATTRIBUTE_MACRO
00261 
00262 
00264 
00268     virtual WT_Result sync(WT_File & file, WT_Integer32 required = 0)
00269     {
00270         WT_Integer32   needed = required & m_changed_flags;
00271         WD_CHECK(m_rendering_options.sync(file));
00272         if (needed)
00273         {
00274             m_changed_flags &= ~needed;
00275             return sync_parts(file, needed);
00276         }
00277         return WT_Result::Success;
00278     }
00279 
00280 };
00281 
00283 
00284 #endif // RENDITION_HEADER

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