lablstyl.h

Go to the documentation of this file.
00001 /**
00002  * \file mi32/lablstyl.h
00003  * \brief Definitions of LABELSTYLE
00004  *
00005  * \if NODOC
00006  * $Id: lablstyl.h_v 1.14 2004/10/14 16:58:26 dwilliss Exp $
00007  *
00008  * $Log: lablstyl.h_v $
00009  * Revision 1.14  2004/10/14 16:58:26  dwilliss
00010  * Added UsesTransparency and UsesAntialiasing methods
00011  *
00012  * Revision 1.13  2004/08/06 15:48:30  dwilliss
00013  * *** empty log message ***
00014  *
00015  * Revision 1.12  2004/06/14 16:06:17  scowan
00016  * Uses mgd enum include file.
00017  *
00018  * Revision 1.11  2003/10/03 22:08:52  dwilliss
00019  * *** empty log message ***
00020  *
00021  * Revision 1.10  2003/10/01 22:37:46  dwilliss
00022  * Added margin and arrow members
00023  *
00024  * Revision 1.9  2003/09/23 13:11:19  mju
00025  * Call base copy ctor in labelstyle copy ctor.
00026  *
00027  * Revision 1.8  2003/09/15 13:49:56  fileserver!dwilliss
00028  * Doxygen
00029  *
00030  * Revision 1.7  2003/06/25 23:03:32  dwilliss
00031  * *** empty log message ***
00032  *
00033  * Revision 1.6  2003/06/25 14:19:16  dwilliss
00034  * *** empty log message ***
00035  *
00036  * Revision 1.5  2003/06/24 16:06:30  dwilliss
00037  * Oops.  Had a "Set" method named as a "Get" method
00038  *
00039  * Revision 1.4  2003/06/24 15:15:31  dwilliss
00040  * *** empty log message ***
00041  *
00042  * Revision 1.3  2003/06/24 14:56:41  dwilliss
00043  * *** empty log message ***
00044  *
00045  * Revision 1.2  2003/06/18 22:58:23  dwilliss
00046  * Finished defining the structure
00047  *
00048  * Revision 1.1  2003/06/18 22:45:00  dwilliss
00049  * Initial revision
00050  *
00051  * \endif
00052 **/
00053 
00054 #ifndef  INC_MI32_LABLSTYL_H
00055 #define  INC_MI32_LABLSTYL_H
00056 
00057 #ifndef  INC_MI32_ELEMSTYL_H
00058 #include <mi32/elemstyl.h>
00059 #endif
00060 
00061 #ifndef  INC_RVC_STYLE_H
00062 #include <rvc/style.h>
00063 #endif
00064 
00065 #ifndef INC_MI32_MG2ENUMS_H
00066 #include <mi32/mg2enums.h>
00067 #endif
00068 
00069 struct SMLCONTEXT;
00070 
00071 //! In-memory structure for labels with frames and leaders.  This is the
00072 //! serializable part of the structure.
00073 class LABELFRAMEPARMS {
00074    public:
00075       enum FRAMESHAPE {
00076          FRAMESHAPE_None = 0,
00077          FRAMESHAPE_Rectangle,
00078          FRAMESHAPE_RoundedRectangle,
00079          FRAMESHAPE_Ellipse,
00080          FRAMESHAPE_Circle
00081          };
00082 
00083       //! Default constructor
00084       LABELFRAMEPARMS (
00085          ) :
00086          m_FrameShape(FRAMESHAPE_None),
00087          m_Margin(0.0),
00088          m_bCartoonBalloonLeaders(false),
00089          m_TMargin(0.0),
00090          m_BMargin(0.0),
00091          m_LMargin(0.0),
00092          m_RMargin(0.0),
00093          m_Arrow(0)
00094          {
00095          }
00096       
00097       //! Copy constructor.
00098       LABELFRAMEPARMS (                         
00099          const LABELFRAMEPARMS& rhs
00100          ) { Copy(rhs); }
00101 
00102       //! Destructor.
00103       ~LABELFRAMEPARMS() {}
00104       
00105       //! Assignment 
00106       LABELFRAMEPARMS& operator= (              
00107          const LABELFRAMEPARMS& rhs
00108          ) { if (this != &rhs) { Copy(rhs); } return (*this); }
00109 
00110       static const SERIALIZER::ITEMDEF* SerialGetItemDef ();
00111 
00112       //! Helper method for copying.
00113       void Copy (                         
00114          const LABELFRAMEPARMS& rhs
00115          );
00116 
00117       bool GetCartoonBalloonLeaders (
00118          ) const {
00119          return m_bCartoonBalloonLeaders;
00120          }
00121 
00122       FRAMESHAPE GetFrameShape (
00123          ) const {
00124          return m_FrameShape;
00125          }
00126 
00127       const POLYSTYLE& GetFrameStyle (
00128          ) const {
00129          return m_FrameStyle;
00130          }
00131 
00132       const LINESTYLE& GetLeaderStyle (
00133          ) const {
00134          return m_LeaderStyle;
00135          }
00136 
00137       // Begin phased out, but old data will have it
00138       double GetMargin (
00139          ) const {
00140          return m_Margin;
00141          }
00142 
00143       double GetTopMargin (
00144          ) const {
00145          return m_TMargin + m_Margin;
00146          }
00147 
00148       double GetBottomMargin (
00149          ) const {
00150          return m_BMargin + m_Margin;
00151          }
00152 
00153       double GetLeftMargin (
00154          ) const {
00155          return m_LMargin + m_Margin;
00156          }
00157 
00158       double GetRightMargin (
00159          ) const {
00160          return m_RMargin + m_Margin;
00161          }
00162 
00163       void SetCartoonBalloonLeaders (
00164          bool value
00165          ) {
00166          m_bCartoonBalloonLeaders = value;
00167          }
00168 
00169       void SetFrameShape (
00170          FRAMESHAPE shape
00171          ) {
00172          m_FrameShape = shape;
00173          }
00174 
00175       void SetFrameStyle (
00176          const POLYSTYLE& style
00177          ) {
00178          m_FrameStyle = style;
00179          }
00180 
00181       void SetLeaderStyle (
00182          const LINESTYLE& style
00183          ) {
00184          m_LeaderStyle = style;
00185          }
00186 
00187       void SetMargin (
00188          double margin
00189          ) {
00190          m_Margin = margin;
00191          }
00192       
00193       void SetTopMargin (
00194          double margin
00195          ) {
00196          m_TMargin = margin;
00197          }
00198       
00199       void SetBottomMargin (
00200          double margin
00201          ) {
00202          m_BMargin = margin;
00203          }
00204       
00205       void SetLeftMargin (
00206          double margin
00207          ) {
00208          m_LMargin = margin;
00209          }
00210       
00211       void SetRightMargin (
00212          double margin
00213          ) {
00214          m_RMargin = margin;
00215          }
00216 
00217       bool UsesTransparency (
00218          ) const {
00219          if (m_FrameShape != FRAMESHAPE_None && m_FrameStyle.UsesTransparency()) return (true);
00220          return (m_LeaderStyle.UsesTransparency());
00221          }
00222 
00223    private:
00224       #ifndef GENERATING_DOXYGEN_OUTPUT
00225       POLYSTYLE m_FrameStyle;
00226       LINESTYLE m_LeaderStyle;
00227       FRAMESHAPE m_FrameShape;
00228       double m_Margin;        //!< Units: % of font ascent 
00229       bool m_bCartoonBalloonLeaders;
00230       double m_TMargin;       //!< Units: % of font ascent
00231       double m_BMargin;       //!< Units: % of font ascent
00232       double m_LMargin;       //!< Units: % of font ascent
00233       double m_RMargin;       //!< Units: % of font ascent
00234       int m_Arrow;
00235 
00236       friend class SML_LABELFRAMEPARMS;   // SML Implementation 
00237       #endif // GENERATING_DOXYGEN_OUTPUT
00238    };
00239 
00240 //! In-memory structure for labels with frames and leaders
00241 class LABELSTYLE : public LABELFRAMEPARMS {
00242    public:
00243 
00244       //! Default constructor
00245       LABELSTYLE (
00246          ) :
00247          LABELFRAMEPARMS(),
00248          m_DesignScale(0.0),
00249          m_bClipUnderPass(false),
00250          m_BaselineFlag(MGD::BASELINE_Straight)
00251          {
00252          }
00253       
00254       //! Construct from base class
00255       LABELSTYLE (
00256          const LABELFRAMEPARMS& rhs
00257          ) :
00258          LABELFRAMEPARMS(rhs),
00259          m_DesignScale(0.0),
00260          m_bClipUnderPass(false),
00261          m_BaselineFlag(MGD::BASELINE_Straight)
00262          {
00263          }
00264       
00265       //! Copy constructor.
00266       LABELSTYLE (                           
00267          const LABELSTYLE& rhs
00268          ): LABELFRAMEPARMS(rhs) { MyCopy(rhs); }
00269 
00270       //! Destructor.
00271       ~LABELSTYLE() {}
00272       
00273       //! Assignment 
00274       LABELSTYLE& operator= (             
00275          const LABELSTYLE& rhs
00276          ) { if (this != &rhs) { MyCopy(rhs); } return (*this); }
00277 
00278 
00279       MGD::BASELINE GetBaselineFlag (
00280          ) const {
00281          return m_BaselineFlag;
00282          }
00283 
00284       const RVC::STYLE::LINEPATTERN& GetBorderPattern (
00285          ) const {
00286          return m_BorderPattern;
00287          }
00288 
00289       bool GetClipUnderPass (
00290          ) const {
00291          return m_bClipUnderPass;
00292          }
00293 
00294       double GetDesignScale (
00295          ) const {
00296          return m_DesignScale;
00297          }
00298 
00299       const RVC::STYLE::BASEPATTERN& GetFramePattern (
00300          ) const {
00301          if (GetFrameStyle().StyleFlags & STYLEFLAG_UseHatchPatt) return m_FramePatternH;
00302          return m_FramePatternB;
00303          }
00304 
00305       const RVC::STYLE::LINEPATTERN& GetLeaderPattern (
00306          ) const {
00307          return m_LeaderPattern;
00308          }
00309 
00310       const TEXTSTYLE& GetTextStyle (
00311          ) const {
00312          return m_TextStyle;
00313          }
00314 
00315       void SetBaselineFlag (
00316          MGD::BASELINE flags
00317          ) {
00318          m_BaselineFlag = flags;
00319          }
00320 
00321       void SetBorderPattern (
00322          const RVC::STYLE::LINEPATTERN& pattern
00323          ) {
00324          m_BorderPattern = pattern;
00325          }
00326 
00327       void SetClipUnderPass (
00328          bool state
00329          ) {
00330          m_bClipUnderPass = state;
00331          }
00332 
00333       void SetDesignScale (
00334          double scale
00335          ) {
00336          m_DesignScale = scale;
00337          }
00338 
00339       void SetFramePattern (
00340          const RVC::STYLE::BITMAPPATTERN& pattern
00341          ) {
00342          m_FramePatternB = pattern;
00343          }
00344 
00345       void SetFramePattern (
00346          const RVC::STYLE::HATCHPATTERN& pattern
00347          ) {
00348          m_FramePatternH = pattern;
00349          }
00350 
00351       void SetLeaderPattern (
00352          const RVC::STYLE::LINEPATTERN& pattern
00353          ) {
00354          m_LeaderPattern = pattern;
00355          }
00356 
00357       void SetTextStyle (
00358          const TEXTSTYLE& style
00359          ) {
00360          m_TextStyle = style;
00361          }
00362 
00363       //! Returns true if the text style is set to do antialiasing
00364       bool UsesAntialiasing (
00365          ) const {
00366          return (m_TextStyle.UsesAntialiasing());
00367          }
00368 
00369       //! Returns true any part of the style (text, frame or leader) uses
00370       //! transparency.
00371       //! Does not account for antialiasing text.
00372       bool UsesTransparency (
00373          ) const {
00374          return (m_TextStyle.UsesTransparency() || LABELFRAMEPARMS::UsesTransparency());
00375          }
00376 
00377    private:
00378       #ifndef GENERATING_DOXYGEN_OUTPUT
00379       TEXTSTYLE m_TextStyle;
00380       double m_DesignScale;
00381       RVC::STYLE::BITMAPPATTERN m_FramePatternB;
00382       RVC::STYLE::HATCHPATTERN m_FramePatternH;
00383       RVC::STYLE::LINEPATTERN m_BorderPattern;
00384       RVC::STYLE::LINEPATTERN m_LeaderPattern;
00385       bool m_bClipUnderPass;
00386       MGD::BASELINE m_BaselineFlag;
00387       friend class SML_LABELSTYLE;  // SML Implementation 
00388       
00389       //! Helper method for copying.
00390       void MyCopy (                          
00391          const LABELSTYLE& rhs
00392          );
00393       #endif // GENERATING_DOXYGEN_OUTPUT
00394    };
00395 
00396 PREVENT_MEMFUNC(LABELSTYLE)
00397 
00398 #endif   //!< INC_MI32_ELEMSTYL_H

Generated on Wed May 31 15:26:54 2006 for TNTsdk by  doxygen 1.3.8-20040913