style.h

Go to the documentation of this file.
00001 /**
00002  * \file rvc/style.h 
00003  * \brief interface for the RVC::STYLE class.
00004  *
00005  * \if NODOC
00006  * $Id: style.h_v 1.66 2005/08/22 20:41:14 vdronov Exp $
00007  *
00008  * $Log: style.h_v $
00009  * Revision 1.66  2005/08/22 20:41:14  vdronov
00010  * text rendering in 3d
00011  *
00012  * Revision 1.65  2005/06/02 19:20:08  vdronov
00013  * *** empty log message ***
00014  *
00015  * Revision 1.64  2005/05/20 21:50:54  vdronov
00016  * added GetWidth
00017  *
00018  * Revision 1.63  2005/04/29 22:07:20  vdronov
00019  * extended SYMBOLPATTERN
00020  *
00021  * Revision 1.62  2005/01/19 21:38:08  scowan
00022  * Added support for descriptor.
00023  *
00024  * Revision 1.61  2004/12/14 17:50:39  mju
00025  * Add parm to getobjfilter for saving to allow navigate under geometric.
00026  *
00027  * Revision 1.60  2004/11/19 17:54:27  mju
00028  * Add basepattern.isEqualDef.
00029  *
00030  * Revision 1.59  2004/11/19 14:45:52  mju
00031  * Add TYPE_First for more intuitive looping.
00032  *
00033  * Revision 1.58  2004/09/03 16:02:34  scowan
00034  * Removed text font name typedef.
00035  *
00036  * Revision 1.57  2004/06/16 17:29:08  scowan
00037  * Added style edit for multi style.
00038  *
00039  * Revision 1.56  2003/10/31 15:41:35  mju
00040  * Change DlgGetPattern to just have const mistring& for prompt.
00041  *
00042  * Revision 1.55  2003/10/15 16:27:50  scowan
00043  * Added more standard filters.
00044  *
00045  * Revision 1.54  2003/10/14 21:52:50  scowan
00046  * Added is selectable filter.
00047  *
00048  * Revision 1.53  2003/10/08 22:18:13  scowan
00049  * Doxygen.
00050  *
00051  * Revision 1.52  2003/10/07 17:30:20  scowan
00052  * Object virtual method changes.
00053  *
00054  * Revision 1.51  2003/10/03 20:15:16  linux32build!build
00055  * Don't capitalize enum any more. Genitor needed it, Doxygen doesn't like it.
00056  *
00057  * Revision 1.50  2003/09/30 16:52:06  dwilliss
00058  * Doxygen
00059  *
00060  * Revision 1.49  2003/09/25 21:20:04  dwilliss
00061  * Fixed doxygen comment
00062  *
00063  * Revision 1.48  2003/09/15 13:49:45  fileserver!dwilliss
00064  * Doxygen
00065  *
00066  * Revision 1.47  2003/09/08 20:25:57  dwilliss
00067  * Added doxygen tags for function groups
00068  *
00069  * Revision 1.46  2003/07/15 15:40:13  dwilliss
00070  * Gave HATCHPATTERN, BITMAPPATTERN and SYMBOLPATTERN copy constructors and
00071  * assignment operators.
00072  *
00073  * Revision 1.45  2003/03/19 22:38:56  scowan
00074  * Added unique filters for styles and patterns.
00075  *
00076  * Revision 1.44  2003/03/13 22:11:54  mju
00077  * Move pattern element offset array to base class protected so can clear on read.
00078  *
00079  * Revision 1.43  2003/03/04 16:53:45  scowan
00080  * Added write pattern name.
00081  *
00082  * Revision 1.42  2003/03/03 15:21:24  mju
00083  * nc.
00084  *
00085  * Revision 1.41  2003/02/27 18:53:58  mju
00086  * Make bitmappattern::create non-inline and remove unimplemented DeleteUnusedColors.
00087  *
00088  * Revision 1.40  2003/02/24 17:29:51  mju
00089  * Had comparison reversed in setOffsetAside.
00090  *
00091  * Revision 1.39  2003/02/24 15:02:24  mju
00092  * In line pattern get/set OffsetAside flip sign for non-line elements so consistent.
00093  *
00094  * Revision 1.38  2003/02/20 19:02:20  mju
00095  * Add linepattern iterator dtor.
00096  *
00097  * Revision 1.37  2003/02/06 21:33:46  scowan
00098  * nc.
00099  *
00100  * Revision 1.36  2003/01/31 18:48:30  mju
00101  * Add parm to TableEditStyleAssignment for optional dft style obj item.
00102  *
00103  * Revision 1.35  2003/01/30 23:04:33  mju
00104  * Allow dft ctor/op= for linepattern::element_shared since behavior would be correct.
00105  *
00106  * Revision 1.34  2003/01/30 22:36:55  mju
00107  * In style editor allow return of modified dftstyle.
00108  *
00109  * Revision 1.33  2003/01/30 18:27:18  mju
00110  * Use explicit on element_shared ctor.
00111  *
00112  * Revision 1.32  2003/01/24 17:20:37  mju
00113  * *** empty log message ***
00114  *
00115  * Revision 1.31  2003/01/24 16:42:41  mju
00116  * Try again to fix for Unix.
00117  *
00118  * Revision 1.30  2003/01/24 14:09:58  mju
00119  * Attempt to fix Unix compile problem.
00120  *
00121  * Revision 1.29  2003/01/23 22:37:48  mju
00122  * Add LINEPATTERN element stuff, iterator, etc.
00123  *
00124  * Revision 1.28  2002/10/14 16:28:01  mju
00125  * Fix EDITSTYLEFLAGS.
00126  *
00127  * Revision 1.27  2002/10/14 15:06:16  mju
00128  * Reorganize EDITSTYLEFLAGS.
00129  *
00130  * Revision 1.26  2002/10/04 17:50:46  mju
00131  * Add Dlg for editing cad style by attrib.
00132  *
00133  * Revision 1.25  2002/08/22 14:24:47  scowan
00134  * nc.
00135  *
00136  * Revision 1.24  2002/08/21 20:39:16  scowan
00137  * Deprecate old object name define.
00138  *
00139  * Revision 1.23  2002/08/13 13:28:59  mju
00140  * Change dlggetpatterns naming.
00141  *
00142  * Revision 1.22  2002/08/12 13:29:36  mju
00143  * Add DlgStyleEdit and DlgTableEdit... fns.
00144  *
00145  * Revision 1.21  2002/05/24 16:30:50  scowan
00146  * Fixed base pattern allocations.
00147  *
00148  * Revision 1.20  2002/05/23 22:28:37  scowan
00149  * Added more pattern methods.
00150  *
00151  * Revision 1.19  2002/05/23 20:44:16  scowan
00152  * Added multiple methods.
00153  *
00154  * Revision 1.18  2002/04/11 19:24:31  scowan
00155  * Added multiple methods dealing with in-memory style structures.
00156  *
00157  * Revision 1.17  2001/10/24 16:18:49  scowan
00158  * Changed return types of delete methods.
00159  *
00160  * Revision 1.14  2001/09/04 17:10:28  mju
00161  * Add DlgEditPattern/PatternSet method defns.
00162  *
00163  * Revision 1.13  2001/08/31 20:04:22  scowan
00164  * Nothing.
00165  *
00166  * Revision 1.12  2001/08/31 19:26:31  mju
00167  * Add WriteStyleName() method defn.
00168  *
00169  * Revision 1.11  2001/08/31 15:57:05  mju
00170  * Use const in FindFontName().
00171  *
00172  * Revision 1.10  2001/08/28 14:56:39  mju
00173  * Change StyleAdd to return style number.
00174  *
00175  * Revision 1.9  2001/08/27 14:53:28  mju
00176  * Use DEFINE_ENUM_OP_INCREMENT on style type.
00177  * Fix inclusion guard name.
00178  *
00179  * Revision 1.8  2001/06/14 16:13:02  scowan
00180  * Changed source type.
00181  *
00182  * Revision 1.7  2001/06/13 22:11:43  scowan
00183  * Added to RVC namespace.
00184  *
00185  * Revision 1.6  2001/06/13 15:04:20  scowan
00186  * Added new make method.
00187  *
00188  * Revision 1.5  2001/06/13 15:02:03  scowan
00189  * Changed enum value.
00190  *
00191  * Revision 1.4  2000/12/01 16:01:45  scowan
00192  * Fixed MAC errors.
00193  *
00194  * Revision 1.3  2000/11/16 17:55:51  scowan
00195  * Different inclusion guards for this file.
00196  *
00197  * Revision 1.1  2000/09/29 15:49:58  scowan
00198  * Initial revision
00199  * \endif
00200 **/
00201 
00202 #ifndef INC_RVC_STYLE_H
00203 #define INC_RVC_STYLE_H
00204 
00205 #ifndef INC_RVC_OBJECT_H
00206    #include <rvc/object.h>
00207 #endif
00208 
00209 #ifndef INC_MI32_RVCSTYLE_H
00210    #include <mi32/rvcstyle.h>
00211 #endif
00212 
00213 #ifndef INC_MI32_ELEMTYPE_H
00214    #include <mi32/elemtype.h>
00215 #endif
00216 
00217 #ifndef INC_MI32_SIMPLEAR_H
00218    #include <mi32/simplear.h>
00219 #endif
00220 
00221 #ifndef INC_MI32_ELEMSTYL_H
00222    #include <mi32/elemstyl.h>
00223 #endif
00224 
00225 #ifndef INC_MI32_MGD2_H
00226    #include <mi32/mgd2.h>
00227 #endif
00228 
00229 #ifndef INC_RVC_GETOBJF_H
00230    #include <rvc/getobjf.h>
00231 #endif
00232 
00233 #ifndef INC_MI32_PLANECONIC_H
00234    #include <mi32/planeconic.h>
00235 #endif
00236 
00237 namespace RVC {
00238 
00239 //!   \class STYLE rvc/style.h
00240 //!   \brief Manages RVC::OBJTYPE_Style RVC objects.
00241 //!   
00242 //!   RVC Object Types that this class supports: RVC::OBJTYPE_Style.
00243 //!
00244 //!   Default RVC Object Type for this class: RVC::OBJTYPE_Style.
00245 //!
00246 //!   Valid parents for this class:
00247 //!      - RVC::OBJTYPE_File
00248 //!      - RVC::OBJTYPE_Folder
00249 //!      - RVC::OBJTYPE_Vector
00250 //!      - RVC::OBJTYPE_TIN
00251 //!      - RVC::OBJTYPE_CAD
00252 //!      - RVC::OBJTYPE_Table
00253 //!      - RVC::OBJTYPE_Raster
00254 //!      - RVC::OBJTYPE_Hyperspectral
00255 //!      - RVC::OBJTYPE_Script_SML
00256 //!      - RVC::OBJTYPE_Script_Query
00257 //!      - RVC::OBJTYPE_Theme
00258 
00259 class STYLE : public RVC::OBJECT {
00260    public:
00261    
00262       #ifndef GENERATING_DOXYGEN_OUTPUT
00263       class BASEPATTERN;
00264       class BITMAPPATTERN;
00265       class HATCHPATTERN;
00266       class GETOBJFILTER_ISSELECTABLE;
00267       class GETOBJFILTER_HASPATTERNTYPE;
00268       class GETOBJFILTER_HASSTYLETYPE;
00269       class LINEPATTERN;
00270       class SYMBOLPATTERN;
00271       class UNIQUEPATTERNNAMEFILTER;
00272       class UNIQUESTYLENAMEFILTER;
00273       #endif // GENERATING_DOXYGEN_OUTPUT
00274       
00275       //! Style type.
00276       enum TYPE {
00277          TYPE_First =      0,
00278          TYPE_Point =      0,
00279          TYPE_Line =       1,
00280          TYPE_Polygon =    2,
00281          TYPE_Text =       3,
00282          TYPE_NumTypes =   4
00283          };
00284 
00285       //! Pattern type.
00286       enum PATTERN {
00287          PATTERN_Symbol = 0,
00288          PATTERN_Line,
00289          PATTERN_Bitmap,
00290          PATTERN_Hatch,
00291          PATTERN_NumTypes
00292          };
00293 
00294       //! Default constructor
00295       STYLE (
00296          );
00297 
00298       //! Copy constructor
00299       STYLE (
00300          const RVC::STYLE& obj
00301          );
00302 
00303       //! Destructor
00304       virtual ~STYLE (
00305          );
00306 
00307       //! Assignment.  Will close if necessary and reopen if 'rhs' is open
00308       RVC::STYLE& operator= (
00309          const RVC::STYLE& rhs
00310          );
00311 
00312       //! Add pattern to rvc style object
00313       //! @return New pattern number
00314       INT32 AddPattern (
00315          PATTERN PattType,             //!< Type of pattern to add
00316          void *Pattern                 //!< Pattern to add
00317          );
00318                               
00319       //! Add pattern to rvc style object
00320       //! @return New pattern number
00321       INT32 AddPattern (
00322          PATTERN PattType,          //!< Type of pattern to add
00323          const BASEPATTERN& Pattern             //!< Pattern to add
00324          );
00325          
00326       //! Add pattern to rvc style object
00327       //! @return New pattern number
00328       INT32 AddPattern (
00329          const BITMAPPATTERN& Pattern              //!< Pattern to add
00330          );
00331          
00332       //! Add pattern to rvc style object
00333       //! @return New pattern number
00334       INT32 AddPattern (
00335          const HATCHPATTERN& Pattern               //!< Pattern to add
00336          );
00337          
00338       //! Add pattern to rvc style object
00339       //! @return New pattern number
00340       INT32 AddPattern (
00341          const LINEPATTERN& Pattern             //!< Pattern to add
00342          );
00343          
00344       //! Add pattern to rvc style object
00345       //! @return New pattern number
00346       INT32 AddPattern (
00347          const SYMBOLPATTERN& Pattern              //!< Pattern to add
00348          );
00349          
00350       //! Add point style to rvc style object   
00351       //! @return New style number or error < 0.
00352       INT32 AddStyle (           
00353          RVCPOINTSTYLE& style          //!< Point style to add
00354          );
00355                               
00356       //! Add point style to rvc style object   
00357       //! @return New style number or error < 0.
00358       INT32 AddStyle (
00359          const RVC::OBJECTNAME& name,
00360          const POINTSTYLE& style          //!< Point style to add
00361          );
00362                               
00363       //! Add polygon style to rvc style object 
00364       //! @return New style number or error < 0.
00365       INT32 AddStyle (           
00366          RVCPOLYSTYLE& style           //!< Polygon style to add
00367          );
00368                               
00369       //! Add polygon style to rvc style object 
00370       //! @return New style number or error < 0.
00371       INT32 AddStyle (
00372          const RVC::OBJECTNAME& name,
00373          const POLYSTYLE& style           //!< Polygon style to add
00374          );
00375                               
00376       //! Add line style to rvc style object    
00377       //! @return New style number or error < 0.
00378       INT32 AddStyle (           
00379          RVCLINESTYLE& style           //!< Line style to add
00380          );
00381                               
00382       //! Add line style to rvc style object 
00383       //! @return New style number or error < 0.
00384       INT32 AddStyle (
00385          const RVC::OBJECTNAME& name,
00386          const LINESTYLE& style           //!< Line style to add
00387          );
00388                               
00389       //! Add text style to rvc style object    
00390       //! @return New style number or error < 0.
00391       INT32 AddStyle (           
00392          RVCTEXTSTYLE& style           //!< Text style to add
00393          );
00394 
00395       //! Add text style to rvc style object 
00396       //! @return New style number or error < 0.
00397       INT32 AddStyle (
00398          const RVC::OBJECTNAME& name,
00399          const TEXTSTYLE& style           //!< Text style to add
00400          );
00401 
00402       //! Combine two style objects together using 'this' as the source and either findint or making
00403       //! the destination style object.  The destination style object is returned in 'DestStyleObj'.
00404       ERRVALUE Combine (
00405          const RVC::OBJECT& DestParentObj,            //!< Parent object to combine / copy to
00406          RVC::STYLE& DestStyleObj,                    //!< Destination object created or found
00407          SIMPLE_ARRAY<INT32>& FontTrans,
00408          SIMPLE_ARRAY<INT32> PattTrans[PATTERN_NumTypes]
00409          );
00410          
00411       //! Combine two style objects together using 'this' as the source and either findint or making
00412       //! the destination style object.  The destination style object is returned in 'DestStyleObj'.
00413       ERRVALUE Combine (
00414          const RVC::OBJECT& DestParentObj,            //!< Parent object to combine / copy to
00415          RVC::STYLE& DestStyleObj                     //!< Destination object created or found
00416          );
00417          
00418       //! Convert between memory and rvc line styles        
00419       void ConvertStyle (
00420          RVCLINESTYLE& rvcstyle,
00421          const LINESTYLE& linestyle
00422          ) const;
00423          
00424       //! Convert between memory and rvc line styles        
00425       void ConvertStyle (
00426          LINESTYLE& linestyle,
00427          const RVCLINESTYLE& rvcstyle
00428          ) const;
00429          
00430       //! Convert between memory and rvc point styles       
00431       void ConvertStyle (
00432          RVCPOINTSTYLE& rvcstyle,
00433          const POINTSTYLE& pointstyle
00434          ) const;
00435          
00436       //! Convert between memory and rvc point styles       
00437       void ConvertStyle (
00438          POINTSTYLE& pointstyle,
00439          const RVCPOINTSTYLE& rvcstyle
00440          ) const;
00441          
00442       //! Convert between memory and rvc polygon styles        
00443       void ConvertStyle (
00444          RVCPOLYSTYLE& rvcstyle,
00445          const POLYSTYLE& polystyle
00446          ) const;
00447          
00448       //! Convert between memory and rvc polygon styles        
00449       void ConvertStyle (
00450          POLYSTYLE& polystyle,
00451          const RVCPOLYSTYLE& rvcstyle
00452          ) const;
00453          
00454       //! Convert between memory and rvc text styles        
00455       void ConvertStyle (
00456          RVCTEXTSTYLE& rvcstyle,
00457          const TEXTSTYLE& textstyle
00458          );             //! Not const, can change object
00459          
00460       //! Convert between memory and rvc text styles        
00461       void ConvertStyle (
00462          TEXTSTYLE& textstyle,
00463          const RVCTEXTSTYLE& rvcstyle
00464          ) const;
00465          
00466       //! Delete pattern from rvc style object, modifies styles that referenced the pattern
00467       //! @return Pattern number that replaced the deleted pattern or <0 if error
00468       INT32 DeletePattern (
00469          PATTERN PattType,             //!< Type of pattern to delete
00470          INT32 PattNum                 //!< Pattern index to delete
00471          );
00472 
00473       //! Delete style from rvc style object
00474       //! @return Style number that replaced the deleted style or <0 if error
00475       INT32 DeleteStyle (
00476          TYPE StyleType,               //!< Type of style to delete
00477          INT32 StyleNum                //!< Style index to delete
00478          );
00479 
00480       //! Delete all styles of a specified type from rvc style object
00481       ERRVALUE DeleteStyleType (
00482          TYPE StyleType                //!< Type of style to delete
00483          );
00484 
00485       //! Locate a font based on a font name and initial position
00486       //! @return Index of font name if found, -1 if none found, < -1 error code
00487       INT32 FindFontName (
00488          INT32 start,                  //!< Best guess of initial font location
00489          const MISTRING& name          //!< Font to search for
00490          ) const;
00491 
00492       //! Add a font name to the font name list
00493       //! @return Index of added font name or error if < 0
00494       INT32 FontTransAdd (
00495          const MISTRING& name          //!< Name of font to add
00496          );
00497 
00498       //! Obtain font handle from a font index
00499       //! @return font handle of error if < 0
00500       INT32 FontTransIndexToHandle (
00501          INT32 FontNum                 //!< Font index to translate into a font handle
00502          );
00503 
00504       //! Obtain font index from a font name
00505       //! @return font index of error if < 0
00506       ERRVALUE FontTransIndexToName (
00507          INT32 FontNum,          
00508          MISTRING& name                //!< Name of font to translate into an index
00509          ) const;
00510 
00511       //! Find a pattern given a name and the pattern type
00512       //! @return -1 if pattern not found, >= 0 Pattern index if found, < -1 error
00513       INT32 FindPattern (
00514          PATTERN PattType,             //!< Type of pattern to search for
00515          INT32 StartPattNum,           //!< Best guess of initial pattern location
00516          const RVC::OBJECTNAME& name   //!< Name of pattern to find
00517          ) const;
00518 
00519       //! Find a style given a name and the style type
00520       //! @return -1 if style not found, >= 0 Style index if found, < -1 error
00521       INT32 FindStyle (
00522          TYPE StyleType,               //!< Type of style to search for
00523          INT32 StartStyleNum,          //!< Best guess of initial style location
00524          const RVC::OBJECTNAME& name   //!< Name of style to find
00525          ) const;
00526 
00527       //! Obtain the number of font names in the list
00528       //! @return Number of font names
00529       INT32 GetFontNameCount (
00530          ) const;
00531 
00532       //! Obtain the number of patterns of a specific pattern type
00533       //! @return Number of patterns of the requested pattern type or < 0 if error
00534       INT32 GetPatternCount (
00535          PATTERN PattType              //!< Type of pattern to get count of
00536          ) const;
00537 
00538       //! Obtain the maximum pattern size of a specific pattern type
00539       //! @return Maximum pattern size of the requested pattern type or < 0 if error
00540       INT32 GetPatternMaxSize (
00541          PATTERN PattType              //!< Type of pattern to get the maximum size of
00542          ) const;
00543 
00544       //! Obtain the pattern size of a specific pattern type
00545       //! @return Pattern size of the requested pattern type or < 0 if error
00546       INT32 GetPatternSize (
00547          PATTERN PattType,             //!< Type of pattern to get the size of
00548          INT32 PattNum                 //!< Pattern index to get the size of
00549          ) const;
00550 
00551       //! Obtain the number of styles of a specific style type
00552       //! @return Number of styles of the requested style type or < 0 if error
00553       INT32 GetStyleCount (
00554          TYPE StyleType                //!< Type of style to get count of
00555          ) const;
00556 
00557       //! Create a new rvc style object under a specified parent rvc object with name, description, and source
00558       ERRVALUE Make (
00559          const RVC::OBJECT& parent,    //!< Parent object to create style object under
00560          const RVC::DESCRIPTOR& Descriptor
00561          );
00562 
00563       //! Create a new rvc style object under a specified parent rvc object with name, description, and source
00564       //! @deprecated Use method that takes a DESCRIPTOR
00565       DEPRECATED ERRVALUE Make (
00566          const RVC::OBJECT& parent,    //!< Parent object to create style object under
00567          const RVC::OBJECTNAME& name,  //!< Name of new style object
00568          const RVC::OBJECTDESC& desc,  //!< Description of new style object
00569          const char* Source = 0        //!< Source of new style object, default is application name
00570          );
00571 
00572       //! Create a new rvc style object under a specified parent rvc object with name, description, and source
00573       ERRVALUE Make (
00574          const RVC::OBJITEM& ObjItem,  //!< Name, Desc of object to create 
00575          const char* Source = 0        //!< Source of new style object, default is application name
00576          );
00577 
00578       //! Read a pattern into a buffer.  The format of the pattern is pattern type specific
00579       ERRVALUE ReadPattern (
00580          PATTERN PattType,             //!< Type of pattern to read
00581          INT32 PatternNum,             //!< Index of pattern to read
00582          void *Pattern                 //!< Pattern buffer to read into
00583          ) const;
00584       
00585       //! Read a pattern into a buffer.  The format of the pattern is pattern type specific
00586       ERRVALUE ReadPattern (
00587          PATTERN PattType,             //!< Type of pattern to read
00588          INT32 PatternNum,             //!< Index of pattern to read
00589          BASEPATTERN& Pattern          //!< Pattern buffer to read into
00590          ) const;
00591       
00592       //! Read a pattern into a buffer.  The format of the pattern is pattern type specific
00593       ERRVALUE ReadPattern (
00594          INT32 PatternNum,             //!< Index of pattern to read
00595          BITMAPPATTERN& Pattern           //!< Pattern buffer to read into
00596          ) const;
00597       
00598       //! Read a pattern into a buffer.  The format of the pattern is pattern type specific
00599       ERRVALUE ReadPattern (
00600          INT32 PatternNum,             //!< Index of pattern to read
00601          HATCHPATTERN& Pattern            //!< Pattern buffer to read into
00602          ) const;
00603       
00604       //! Read a pattern into a buffer.  The format of the pattern is pattern type specific
00605       ERRVALUE ReadPattern (
00606          INT32 PatternNum,             //!< Index of pattern to read
00607          LINEPATTERN& Pattern          //!< Pattern buffer to read into
00608          ) const;
00609       
00610       //! Read a pattern into a buffer.  The format of the pattern is pattern type specific
00611       ERRVALUE ReadPattern (
00612          INT32 PatternNum,             //!< Index of pattern to read
00613          SYMBOLPATTERN& Pattern           //!< Pattern buffer to read into
00614          ) const;
00615       
00616       //! Read a pattern header into a buffer.
00617       ERRVALUE ReadPatternHdr (
00618          PATTERN PattType,             //!< Type of pattern to read
00619          INT32 PatternNum,             //!< Index of pattern to read
00620          void *PattHdr                 //!< Pattern header buffer to read into
00621          ) const;
00622 
00623       //! Read a pattern name
00624       ERRVALUE ReadPatternName (
00625          PATTERN PattType,             //!< Type of pattern to read
00626          INT32 PattNum,                //!< Index of pattern to read
00627          RVC::OBJECTNAME& name         //!< Place to store pattern name
00628          ) const;
00629 
00630       //! Read a point style item
00631       ERRVALUE ReadStyle (
00632          INT32 StyleNum,               //!< Index of point style to read
00633          RVCPOINTSTYLE& style          //!< Point style instance to read into
00634          ) const;
00635 
00636       //! Read a point style item
00637       ERRVALUE ReadStyle (
00638          INT32 StyleNum,               //!< Index of point style to read
00639          POINTSTYLE& style          //!< Point style instance to read into
00640          ) const;
00641 
00642       //! Read a polygon style item
00643       ERRVALUE ReadStyle (
00644          INT32 StyleNum,               //!< Index of polygon style to read
00645          RVCPOLYSTYLE& style           //!< Polygon style instance to read into
00646          ) const;
00647 
00648       //! Read a polygon style item
00649       ERRVALUE ReadStyle (
00650          INT32 StyleNum,               //!< Index of polygon style to read
00651          POLYSTYLE& style           //!< Polygon style instance to read into
00652          ) const;
00653 
00654       //! Read a line style item
00655       ERRVALUE ReadStyle (
00656          INT32 StyleNum,               //!< Index of line style to read
00657          RVCLINESTYLE& style           //!< Line style instance to read into
00658          ) const;
00659 
00660       //! Read a line style item
00661       ERRVALUE ReadStyle (
00662          INT32 StyleNum,               //!< Index of line style to read
00663          LINESTYLE& style           //!< Line style instance to read into
00664          ) const;
00665 
00666       //! Read a text style item
00667       ERRVALUE ReadStyle (
00668          INT32 StyleNum,               //!< Index of text style to read
00669          RVCTEXTSTYLE& style           //!< Tezt style instance to read into
00670          ) const;
00671 
00672       //! Read a text style item
00673       ERRVALUE ReadStyle (
00674          INT32 StyleNum,               //!< Index of text style to read
00675          TEXTSTYLE& style           //!< Tezt style instance to read into
00676          ) const;
00677 
00678       //! Read style name given a style type
00679       ERRVALUE ReadStyleName (
00680          TYPE StyleType,               //!< Type of style to get the name of
00681          INT32 StyleNum,               //!< Index of style to get the name of
00682          RVC::OBJECTNAME& name         //!< Place to store style name
00683          ) const;
00684 
00685       //! Write pattern out to rvc style object
00686       ERRVALUE WritePattern (
00687          PATTERN PattType,             //!< Type of pattern to write
00688          INT32 PatternNum,             //!< Index of pattern to write, Use AddPattern() to write out a new pattern
00689          void *Pattern                 //!< Pattern to write
00690          );
00691 
00692       //! Write pattern out to rvc style object
00693       ERRVALUE WritePattern (
00694          PATTERN PattType,             //!< Type of pattern to write
00695          INT32 PatternNum,             //!< Index of pattern to write, Use AddPattern() to write out a new pattern
00696          const BASEPATTERN& Pattern                //!< Pattern to write
00697          );
00698 
00699       //! Write pattern out to rvc style object
00700       ERRVALUE WritePattern (
00701          INT32 PatternNum,             //!< Index of pattern to write, Use AddPattern() to write out a new pattern
00702          const BITMAPPATTERN& Pattern                 //!< Pattern to write
00703          );
00704 
00705       //! Write pattern out to rvc style object
00706       ERRVALUE WritePattern (
00707          INT32 PatternNum,             //!< Index of pattern to write, Use AddPattern() to write out a new pattern
00708          const HATCHPATTERN& Pattern                  //!< Pattern to write
00709          );
00710 
00711       //! Write pattern out to rvc style object
00712       ERRVALUE WritePattern (
00713          INT32 PatternNum,             //!< Index of pattern to write, Use AddPattern() to write out a new pattern
00714          const LINEPATTERN& Pattern                //!< Pattern to write
00715          );
00716 
00717       //! Write pattern out to rvc style object
00718       ERRVALUE WritePattern (
00719          INT32 PatternNum,             //!< Index of pattern to write, Use AddPattern() to write out a new pattern
00720          const SYMBOLPATTERN& Pattern                 //!< Pattern to write
00721          );
00722 
00723       //! Write pattern name given a pattern type.
00724       ERRVALUE WritePatternName (
00725          PATTERN PattType,             //!< Type of pattern to write name
00726          INT32 PatternNum,             //!< Index of pattern to write name
00727          const OBJECTNAME& name        //!< New name of pattern
00728          );
00729    
00730       //! Write point style to rvc style object
00731       ERRVALUE WriteStyle (
00732          INT32 StyleNum,               //!< Index of point style to write.  Use AddStyle() to add a style
00733          RVCPOINTSTYLE& style          //!< Point style to write
00734          );
00735 
00736       //! Write point style to rvc style object
00737       ERRVALUE WriteStyle (
00738          INT32 StyleNum,               //!< Index of point style to write.  Use AddStyle() to add a style
00739          const RVC::OBJECTNAME& name,
00740          const POINTSTYLE& style          //!< Point style to write
00741          );
00742 
00743       //! Write polygon style to rvc style object
00744       ERRVALUE WriteStyle (            
00745          INT32 StyleNum,               //!< Index of polygon style to write.  Use AddStyle() to add a style.
00746          RVCPOLYSTYLE& style           //!< Polygon style to write
00747          );
00748 
00749       //! Write polygon style to rvc style object
00750       ERRVALUE WriteStyle (            
00751          INT32 StyleNum,               //!< Index of polygon style to write.  Use AddStyle() to add a style.
00752          const RVC::OBJECTNAME& name,
00753          const POLYSTYLE& style           //!< Polygon style to write
00754          );
00755 
00756       //! Write line style to rvc style object
00757       ERRVALUE WriteStyle (
00758          INT32 StyleNum,               //!< Index of line style to write.  Use AddStyle() to add a style.
00759          RVCLINESTYLE& style           //!< Line style to write
00760          );
00761 
00762       //! Write line style to rvc style object
00763       ERRVALUE WriteStyle (
00764          INT32 StyleNum,               //!< Index of line style to write.  Use AddStyle() to add a style.
00765          const RVC::OBJECTNAME& name,
00766          const LINESTYLE& style           //!< Line style to write
00767          );
00768 
00769       //! Write text style to rvc style object.
00770       ERRVALUE WriteStyle (
00771          INT32 StyleNum,               //!< Index of text style to write.  Use AddStyle() to add a style.
00772          RVCTEXTSTYLE& style           //!< Text style to write
00773          );
00774 
00775       //! Write text style to rvc style object.
00776       ERRVALUE WriteStyle (
00777          INT32 StyleNum,               //!< Index of text style to write.  Use AddStyle() to add a style.
00778          const RVC::OBJECTNAME& name,
00779          const TEXTSTYLE& style           //!< Text style to write
00780          );
00781 
00782       //! Write style name given a style type.
00783       ERRVALUE WriteStyleName (
00784          TYPE StyleType,               //!< Type of style
00785          INT32 StyleNum,               //!< Index of style
00786          const RVC::OBJECTNAME& name   //!< Style name to write
00787          );
00788 
00789    private:
00790       #ifndef GENERATING_DOXYGEN_OUTPUT
00791 
00792       //! Implementation of RVC::OBJECT virtual methods
00793       virtual ERRVALUE v_CloseObject ();
00794       virtual OBJTYPE v_GetDftObjectType () const;
00795       virtual bool v_IsObjectOpen () const;
00796       virtual ERRVALUE v_OpenObject (OPENMODE OpenFlags, MDLGPARENT parent);
00797 
00798       int m_StyleID;
00799       #endif // GENERATING_DOXYGEN_OUTPUT
00800 
00801    };
00802 
00803 
00804 //! Base pattern class.
00805 class STYLE::BASEPATTERN {
00806    public:
00807 
00808       //! Default constructor used by style object.
00809       BASEPATTERN (
00810          ) : m_PattBuff(0), m_PattHdrSize(sizeof(RVCPATTHDR)), m_PattBuffSize(sizeof(RVCPATTHDR)), m_BuffSizeAlloc(sizeof(RVCPATTHDR))
00811          { MmAllocCExc((void**)&m_PattBuff, m_PattBuffSize); }
00812          
00813       //! Destructor.
00814       ~BASEPATTERN (
00815          ) { MmFree(m_PattBuff); }
00816 
00817       //! Append color to end of palette.
00818       //! Note, this will invalidate all derived class ITERATORs.
00819       ERRVALUE AppendColor (
00820          const COLOR& color
00821          );
00822 
00823       //! Clear pattern contents.
00824       void Clear (
00825          ) { m_PattBuffSize = m_PattHdrSize; memset(m_PattBuff,0,m_PattHdrSize); }
00826 
00827       //! Get pattern name.         
00828       const RVC::OBJECTNAME& GetName (
00829          ) const { return (*reinterpret_cast<const RVC::OBJECTNAME*>(m_PattBuff)); }
00830 
00831       //! Get color at specified palette index.
00832       const COLOR& GetColor (
00833          UINT8 idx
00834          ) const { return (GetColors()[idx]); }
00835 
00836       //! Get color palette.
00837       const COLOR* GetColors (
00838          ) const { return (reinterpret_cast<COLOR*>(m_PattBuff + m_PattHdrSize)); }
00839          
00840       //! Get number of colors in pattern palette.
00841       INT32 GetNumColors (
00842          ) const { return (reinterpret_cast<const RVCPATTHDR*>(m_PattBuff)->numcolors); }
00843 
00844       //! Get number of pattern elements.
00845       INT32 GetNumElements (
00846          ) const { return (reinterpret_cast<const RVCPATTHDR*>(m_PattBuff)->numelements); }
00847 
00848       //! Get pattern buffer size.
00849       // XXX make protected when possible.
00850       INT32 GetSize (
00851          ) const { return (m_PattBuffSize); }
00852 
00853       //! Determine if pattern definitions equal, excluding name.
00854       bool IsEqualDef (
00855          const BASEPATTERN& rhs
00856          ) const {
00857          if (m_PattBuffSize != rhs.m_PattBuffSize) return (false);
00858          return (memcmp(m_PattBuff+sizeof(RVC::OBJECTNAME),rhs.m_PattBuff+sizeof(RVC::OBJECTNAME),m_PattBuffSize-sizeof(RVC::OBJECTNAME))==0);
00859          }
00860 
00861       //! Set color at specified palette index.
00862       void SetColor (
00863          UINT8 idx,
00864          const COLOR& color
00865          ) { if (idx < GetNumColors()) reinterpret_cast<COLOR*>(m_PattBuff + m_PattHdrSize)[idx] = color; }
00866 
00867       //! Set pattern name.
00868       void SetName (
00869          const OBJECTNAME& name
00870          ) { *reinterpret_cast<RVC::OBJECTNAME*>(m_PattBuff) = name; }
00871 
00872       //! This method was added for use only in HATCHPATTERN because it has embedded LINEPATTERN
00873       ERRVALUE SetPattern (
00874          void* SrcPattBuff,
00875          INT32 PattBuffSize,
00876          INT32 PattHdrSize
00877          );
00878 
00879       //! To support legacy code, for now.
00880       // XXX delete when drawing code updated.
00881       operator const void* (
00882          ) const { return (m_PattBuff); }
00883 
00884          
00885    protected:
00886 
00887       //! Constructor used by derived classes.
00888       BASEPATTERN (
00889          int PattHdrSize
00890          ) : m_PattBuff(0), m_PattHdrSize(PattHdrSize), m_PattBuffSize(PattHdrSize), m_BuffSizeAlloc(PattHdrSize)
00891          { MmAllocCExc((void**)&m_PattBuff, m_PattBuffSize); }
00892          
00893       //! Copy constructor.
00894       BASEPATTERN (const BASEPATTERN& rhs);
00895 
00896       //! Assignment.
00897       BASEPATTERN& operator= (const BASEPATTERN& rhs);
00898       
00899       //! Delete colors in specified set.
00900       void DeleteColorSet (
00901          const UINT8 *set              //!< Byte array with entries set to non-zero to delete, zero to retain
00902          );
00903 
00904       //! Delete from pattern buffer at specified location.
00905       void DeleteFromBuffer (
00906          INT32 offset,
00907          INT32 numbytes
00908          );
00909 
00910       //! Get const pointer to pattern buffer.
00911       const UINT8* GetPattBuffer (
00912          ) const { return (m_PattBuff); }
00913 
00914       //! Get non-const pointer to pattern buffer.
00915       UINT8* GetPattBuffer (
00916          ) { return (m_PattBuff); }
00917 
00918       //! Get const pointer to first pattern 'element'.
00919       const UINT8* GetFirstElemPtr (
00920          ) const { return (m_PattBuff+m_PattHdrSize+GetNumColors()*sizeof(COLOR)); }
00921 
00922       //! Get non-const pointer to first pattern 'element'.
00923       UINT8* GetFirstElemPtr (
00924          ) { return (m_PattBuff+m_PattHdrSize+GetNumColors()*sizeof(COLOR)); }
00925 
00926       //! Insert space into pattern buffer at specified location
00927       ERRVALUE InsertIntoBuffer (
00928          INT32 offset,
00929          INT32 numbytes,
00930          const void *data = 0
00931          );
00932          
00933       #ifndef GENERATING_DOXYGEN_OUTPUT
00934       UINT8* m_PattBuff;
00935       INT32 m_PattHdrSize;
00936       INT32 m_PattBuffSize;
00937       mutable SIMPLE_ARRAY<UINT32> m_OffsetArray;
00938       #endif // GENERATING_DOXYGEN_OUTPUT
00939       
00940    private:
00941       #ifndef GENERATING_DOXYGEN_OUTPUT
00942 
00943       INT32 m_BuffSizeAlloc;
00944 
00945       friend class STYLE;
00946       #endif // GENERATING_DOXYGEN_OUTPUT
00947    };
00948 
00949 
00950 //! Bitmap pattern class.  
00951 class STYLE::BITMAPPATTERN : public STYLE::BASEPATTERN {
00952    public:
00953 
00954       //! Default constructor.
00955       BITMAPPATTERN (
00956          ) : BASEPATTERN(sizeof(BITMAPPATTHDR)) {}
00957 
00958       //! Copy constructor.
00959       BITMAPPATTERN (
00960          const BITMAPPATTERN& rhs
00961          ) : BASEPATTERN(rhs) {}
00962 
00963       //! Destructor.
00964       ~BITMAPPATTERN (
00965          ) { }
00966 
00967       //! Assignment.
00968       BITMAPPATTERN& operator= (
00969          const BITMAPPATTERN& rhs
00970          ) { if (this != &rhs) { BASEPATTERN::operator=(rhs); } return (*this); }
00971          
00972       ERRVALUE Create (
00973          INT16 xsize,
00974          INT16 ysize
00975          );
00976          
00977       UINT8 GetCell (
00978          INT16 x,
00979          INT16 y
00980          ) const { return (GetFirstElemPtr()[y*GetSizeX()+x]); }
00981 
00982       INT16 GetHotSpotX (
00983          ) const { return (reinterpret_cast<const BITMAPPATTHDR*>(m_PattBuff)->xhot); }
00984 
00985       INT16 GetHotSpotY (
00986          ) const { return (reinterpret_cast<const BITMAPPATTHDR*>(m_PattBuff)->yhot); }
00987 
00988       INT16 GetIntervalX (
00989          ) const { return (reinterpret_cast<const BITMAPPATTHDR*>(m_PattBuff)->xspace); }
00990 
00991       INT16 GetIntervalY (
00992          ) const { return (reinterpret_cast<const BITMAPPATTHDR*>(m_PattBuff)->yspace); }
00993 
00994       INT16 GetSizeX (
00995          ) const { return (reinterpret_cast<const BITMAPPATTHDR*>(m_PattBuff)->xsize); }
00996 
00997       INT16 GetSizeY (
00998          ) const { return (reinterpret_cast<const BITMAPPATTHDR*>(m_PattBuff)->ysize); }
00999 
01000       void SetCell (
01001          INT16 x,
01002          INT16 y,
01003          UINT8 value
01004          ) { GetFirstElemPtr()[y*GetSizeX()+x] = value; }
01005 
01006       void SetHotSpotX (
01007          INT16 hotspotx
01008          ) { reinterpret_cast<BITMAPPATTHDR*>(m_PattBuff)->xhot = hotspotx; }
01009 
01010       void SetHotSpotY (
01011          INT16 hotspoty
01012          ) { reinterpret_cast<BITMAPPATTHDR*>(m_PattBuff)->yhot = hotspoty; }
01013 
01014       void SetIntervalX (
01015          INT16 intervalx
01016          ) { reinterpret_cast<BITMAPPATTHDR*>(m_PattBuff)->xspace = intervalx; }
01017 
01018       void SetIntervalY (
01019          INT16 intervaly
01020          ) { reinterpret_cast<BITMAPPATTHDR*>(m_PattBuff)->yspace = intervaly; }
01021 
01022    };
01023    
01024 //! Line pattern class. 
01025 class STYLE::LINEPATTERN : public STYLE::BASEPATTERN {
01026    public:
01027 
01028       enum ELEMENT_TYPE {
01029          ELEMENT_TYPE_Line =        0,
01030          ELEMENT_TYPE_CrossLine =   1,
01031          ELEMENT_TYPE_Circle =      2,
01032          ELEMENT_TYPE_Polyline =    3,
01033          ELEMENT_TYPE_Polygon =     4,
01034          ELEMENT_TYPE_Text =        5,
01035          ELEMENT_TYPE_Symbol =      6,
01036          ELEMENT_TYPE_COUNT
01037          };
01038 
01039       class ITERATOR;
01040       class ELEMENT;
01041 
01042       //! Pattern element referencing shared memory buffer.
01043       //! Primarily used by ITERATOR.
01044       class ELEMENT_SHARED {
01045          public:
01046 
01047             //! Get cap style.
01048             //! @return Line cap style.
01049             MGD::LINECAP GetCapStyle (
01050                ) const { return ((m_pData->flags & LINEPATTFLAG_CapRound) ? MGD::LINECAP_Round : MGD::LINECAP_Butt); }
01051 
01052             //! Get color index.
01053             //! @return Index into color array.
01054             UINT8 GetColorIndex (
01055                ) const { return (m_pData->colornum); }
01056 
01057             //! Get interval between repeated elements.
01058             //! @return Interval in 1/100 millimeter.
01059             INT16 GetInterval (
01060                ) const { return (m_pData->xspacing); }
01061                
01062             MGD::LINEJOIN GetJoinStyle (
01063                ) const { return ((m_pData->flags & LINEPATTFLAG_JoinMiter) ? MGD::LINEJOIN_Miter : (m_pData->flags & LINEPATTFLAG_JoinBevel) ? MGD::LINEJOIN_Bevel : MGD::LINEJOIN_Round); }
01064 
01065             //! Get offset to start of element along line from beginning.
01066             //! @return Offset in 1/100 millimeter.
01067             INT16 GetOffsetAlong (
01068                ) const { return (m_pData->xoffset); }
01069 
01070             //! Get offset aside line (left -, right +).
01071             //! @return Offset in 1/100 millimeter.
01072             INT16 GetOffsetAside (
01073                ) const { return ((m_pData->type != ELEMENT_TYPE_Line) ? -m_pData->yoffset : m_pData->yoffset); }
01074 
01075             //! Get size/length of element.
01076             //! @return Size in 1/100 millimeter.
01077             INT16 GetSize (
01078                ) const { return (m_pData->xsize); }
01079 
01080             //! Get element line thickness.
01081             //! @return Thickness in 1/100 millimeter.
01082             INT16 GetThickness (
01083                ) const { return (m_pData->thickness); }
01084 
01085             //! Get element type.
01086             //! @return Element type.
01087             ELEMENT_TYPE GetType (
01088                ) const { return (static_cast<ELEMENT_TYPE>(m_pData->type)); }
01089 
01090             //! Determine if element is 'filled'.
01091             //! @return 'true' if filled, 'false' if not.
01092             bool IsFilled (
01093                ) const { return ((m_pData->flags & LINEPATTFLAG_Filled) != 0); }
01094 
01095          private:
01096             #ifndef GENERATING_DOXYGEN_OUTPUT
01097 
01098             const LINEPATTELEM *m_pData;
01099             void *m_pExtra;
01100 
01101             //! Default constructor.
01102             ELEMENT_SHARED (
01103                ): m_pData(0), m_pExtra(0) { }
01104 
01105             explicit ELEMENT_SHARED (const void *pElemData)
01106                : m_pData(static_cast<const LINEPATTELEM*>(pElemData)), m_pExtra(static_cast<UINT8*>(const_cast<void*>(pElemData)) + sizeof(LINEPATTELEM))
01107                { }
01108 
01109             //! Destructor.
01110             ~ELEMENT_SHARED (
01111                ) { }
01112 
01113             friend class RVC::STYLE::LINEPATTERN;
01114             friend class ELEMENT;
01115             friend class ITERATOR;
01116             #endif // GENERATING_DOXYGEN_OUTPUT
01117          };
01118 
01119       //! Pattern element.
01120       class ELEMENT : public ELEMENT_SHARED {
01121          public:
01122 
01123             //! Default constructor.
01124             ELEMENT (
01125                ) { memset(&m_MyData,0,sizeof(m_MyData)); m_pData = &m_MyData; }
01126 
01127             //! Copy constructor.
01128             ELEMENT (
01129                const ELEMENT& rhs
01130                );
01131 
01132             //! Construct from ELEMENT_SHARED.
01133             ELEMENT (
01134                const ELEMENT_SHARED& rhs
01135                );
01136 
01137             //! Construct element of specified type.
01138             explicit ELEMENT (
01139                ELEMENT_TYPE type
01140                );
01141 
01142             //! Destructor.
01143             ~ELEMENT (
01144                ) { if (m_pExtra != 0) free(m_pExtra); }
01145 
01146             //! Assignment from ELEMENT.
01147             ELEMENT& operator= (
01148                const ELEMENT& rhs
01149                );
01150 
01151             //! Assignment from ELEMENT_SHARED.
01152             ELEMENT& operator= (
01153                const ELEMENT_SHARED& rhs
01154                );
01155 
01156             //! Set line 'cap style' for dashed and crossing lines.
01157             void SetCapStyle (
01158                MGD::LINECAP linecap
01159                ) { if (linecap == MGD::LINECAP_Round) m_MyData.flags |= LINEPATTFLAG_CapRound; else m_MyData.flags &= ~LINEPATTFLAG_CapRound; }
01160 
01161             //! Set element color index.
01162             void SetColorIndex (
01163                UINT8 idx
01164                ) { m_MyData.colornum = idx; }
01165 
01166             void SetFilled (
01167                bool filled
01168                ) { if (filled) m_MyData.flags |= LINEPATTFLAG_Filled; else m_MyData.flags &= ~LINEPATTFLAG_Filled; }
01169 
01170             void SetInterval (
01171                INT16 interval
01172                ) { m_MyData.xspacing = interval; }
01173 
01174             void SetJoinStyle (
01175                MGD::LINEJOIN linejoin
01176                ) {
01177                m_MyData.flags &= ~(LINEPATTFLAG_JoinMiter|LINEPATTFLAG_JoinBevel);
01178                if (linejoin == MGD::LINEJOIN_Miter) m_MyData.flags |= LINEPATTFLAG_JoinMiter;
01179                else if (linejoin == MGD::LINEJOIN_Bevel) m_MyData.flags |= LINEPATTFLAG_JoinBevel;
01180                }
01181 
01182             void SetOffsetAlong (
01183                INT16 offset
01184                ) { m_MyData.xoffset = offset; }
01185 
01186             void SetOffsetAside (
01187                INT16 offset
01188                ) { m_MyData.yoffset = (m_MyData.type != ELEMENT_TYPE_Line) ? -offset : offset; }
01189 
01190             void SetSize (
01191                INT16 size
01192                ) { m_MyData.xsize = size; }
01193 
01194             void SetThickness (
01195                INT16 thickness
01196                ) { m_MyData.thickness = thickness; }
01197 
01198          private:
01199             #ifndef GENERATING_DOXYGEN_OUTPUT
01200             LINEPATTELEM m_MyData;
01201             #endif // GENERATING_DOXYGEN_OUTPUT
01202          };
01203 
01204       //! Iterator to process pattern elements.
01205       class ITERATOR {
01206          public:
01207 
01208             //! Default constructor.
01209             ITERATOR (
01210                ): m_pEnd(0) { }
01211 
01212             //! Destructor.
01213             ~ITERATOR (
01214                ) { }
01215 
01216             //! Dereference operator, returns reference to ELEMENT_SHARED.
01217             const ELEMENT_SHARED& operator* (
01218                ) const { return (m_element); }
01219 
01220             //! Dereference operator, returns pointer to ELEMENT_SHARED.
01221             const ELEMENT_SHARED* operator-> (
01222                ) const { return (&m_element); }
01223 
01224             //! Pre-increment operator.
01225             ITERATOR& operator++ ();
01226 
01227             //! Equality operator
01228             bool operator== (
01229                const ITERATOR& rhs
01230                ) const { return ((m_pEnd == 0 && rhs.m_pEnd == 0) || m_element.m_pData == rhs.m_element.m_pData); }
01231 
01232             //! Inequality operator
01233             bool operator!= (
01234                const ITERATOR& rhs
01235                ) const { return (!(*this == rhs)); }
01236 
01237          private:
01238             #ifndef GENERATING_DOXYGEN_OUTPUT
01239 
01240             ELEMENT_SHARED m_element;
01241             const void *m_pEnd;
01242 
01243             ITERATOR (const void *pData, const void *pEnd)
01244                : m_element(pData), m_pEnd(pEnd)
01245                { }
01246 
01247             friend class RVC::STYLE::LINEPATTERN;
01248             #endif // GENERATING_DOXYGEN_OUTPUT
01249          };
01250 
01251       //! Default constructor.
01252       LINEPATTERN (
01253          ) : BASEPATTERN(sizeof(LINEPATTHDR)) {}
01254 
01255       //! Copy constructor.
01256       LINEPATTERN (
01257          const LINEPATTERN& rhs
01258          ) : BASEPATTERN(rhs) {}
01259 
01260       //! Destructor.
01261       ~LINEPATTERN (
01262          ) { }
01263 
01264       //! Assignment.
01265       LINEPATTERN& operator= (
01266          const LINEPATTERN& rhs
01267          ) { if (this != &rhs) { BASEPATTERN::operator=(rhs); } return (*this); }
01268 
01269       //! Get iterator for beginning element.
01270       ITERATOR Begin (
01271          ) const { return (ITERATOR(GetFirstElemPtr(),GetPattBuffer()+GetSize())); }
01272 
01273       //! Delete element at specified index.
01274       //! This will invalidate all ITERATORs.
01275       ERRVALUE DeleteElement (
01276          unsigned idx
01277          );
01278 
01279       //! Delete unused colors from pattern palette.
01280       //! This will invalidate all ITERATORs.
01281       void DeleteUnusedColors (
01282          );
01283 
01284       //! Get iterator for end comparison.
01285       ITERATOR End (
01286       #ifdef WIN32
01287          ) const { return (ITERATOR()); }
01288       #else
01289          ) const { ITERATOR it; return (it); }
01290       #endif
01291 
01292       //! Get element at specified index.
01293       //! Note, this is less efficient than using iterator.
01294       ELEMENT GetElement (
01295          unsigned idx
01296          ) const;
01297 
01298       //! Get extent of pattern to 'left' as drawn (not including 'crossing' elements).
01299       INT16 GetExtentLeft (
01300          ) const { return (reinterpret_cast<LINEPATTHDR*>(m_PattBuff)->extentsa); }
01301 
01302       //! Get extent of pattern to 'right' as drawn (not including 'crossing' elements).
01303       INT16 GetExtentRight (
01304          ) const { return (reinterpret_cast<LINEPATTHDR*>(m_PattBuff)->extentsb); }
01305 
01306       //! Insert element at specified index.
01307       //! This will invalidate all ITERATORs.
01308       ERRVALUE InsertElement (
01309          unsigned idx,
01310          const ELEMENT& element
01311          );
01312 
01313       //! Set (replace) element at specified index.
01314       //! If element size changes this will invalidate all ITERATORs.
01315       ERRVALUE SetElement (
01316          unsigned idx,
01317          const ELEMENT& element
01318          );
01319 
01320       //! GetWidth - Return width if line pattern in 1/100th of a mm
01321       INT32 GetWidth (
01322          ) const;
01323 
01324    private:
01325       #ifndef GENERATING_DOXYGEN_OUTPUT
01326 
01327       ERRVALUE BuildOffsetIndex () const;
01328       INT32 GetOffset (unsigned idx) const;
01329       #endif // GENERATING_DOXYGEN_OUTPUT
01330    };
01331 
01332 
01333 //! Hatch pattern class.
01334 class STYLE::HATCHPATTERN : public STYLE::BASEPATTERN {
01335    public:
01336 
01337       enum ELEMENT_TYPE {
01338          ELEMENT_TYPE_Simple      = 0,
01339          ELEMENT_TYPE_LinePattern = 1,
01340          ELEMENT_TYPE_SolidFill   = 2,
01341          ELEMENT_TYPE_COUNT       = 3
01342          };
01343 
01344       class ITERATOR;
01345       class ELEMENT;
01346 
01347       //! Pattern element referencing shared memory buffer.
01348       //! Primarily used by ITERATOR.
01349       class ELEMENT_SHARED {
01350          public:
01351 
01352             //! Get element type.
01353             //! @return Element type.
01354             ELEMENT_TYPE GetType (
01355                ) const { return (static_cast<ELEMENT_TYPE>(m_pData->type)); }
01356 
01357             //! Get color index.
01358             //! @return Index into color array.
01359             UINT8 GetColorIndex (
01360                ) const { return (m_pData->colornum); }
01361 
01362             //! Determine if element is visible.
01363             //! @return 'true' if visible, 'false' if not.
01364             bool IsVisible (
01365                ) const { return (m_pData->isvisible != 0); }
01366 
01367             //! Get element line pattern.
01368             void GetLinePattern (
01369                STYLE::LINEPATTERN& pattern
01370                ) const;
01371 
01372             //! Get element flags.
01373             UINT32 GetFlags (
01374                ) const { return 0; };
01375 
01376             //! Get element origin offset.
01377             void GetOriginOffset (
01378                DPOINT2D& offset
01379                ) const { offset.x = m_pData->xoffset; offset.y = m_pData->yoffset; return; }
01380 
01381             //! Get spacing between repeated elements.
01382             //! @return spacing in 1/100 millimeter.
01383             double GetSpacing (
01384                ) const { return (m_pData->spacing); }
01385 
01386             //! Get element angle.
01387             //! @return angle in radians.
01388             double GetAn