Text.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: Text.hpp 1644 2009-01-27 19:26:14Z ckiesch $"
00002 
00004 
00005 //============================================================================
00006 //
00007 //  This file is part of GPSTk, the GPS Toolkit.
00008 //
00009 //  The GPSTk is free software; you can redistribute it and/or modify
00010 //  it under the terms of the GNU Lesser General Public License as published
00011 //  by the Free Software Foundation; either version 2.1 of the License, or
00012 //  any later version.
00013 //
00014 //  The GPSTk is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 //  GNU Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with GPSTk; if not, write to the Free Software Foundation,
00021 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //  
00023 //  Copyright 2004, The University of Texas at Austin
00024 //
00025 //============================================================================
00026 
00027 
00028 #ifndef VDRAW_TEXT_H
00029 #define VDRAW_TEXT_H
00030 
00031 #include <string>
00032 #include <stdio.h>
00033 
00034 #include "VDrawException.hpp"
00035 #include "TextStyle.hpp"
00036 
00037 namespace vdraw
00038 {
00041 
00042 
00046   class Text {
00047 
00048     public:
00049 
00051       double x; 
00052 
00054       double y;
00055 
00059       enum ALIGNMENT {LEFT, CENTER, RIGHT};
00060 
00071       Text(const char* str, double ix, double iy, ALIGNMENT align=LEFT, int angle=0);
00072 
00084       Text(const char* str, double ix, double iy, const TextStyle& its, ALIGNMENT align=LEFT, int angle=0);
00085 
00096       Text(int num, double ix, double iy, ALIGNMENT align=LEFT, int angle=0);
00097 
00109       Text(int num, double ix, double iy, const TextStyle& its, ALIGNMENT align=LEFT, int angle=0);
00110 
00111 
00116       inline void setText(const std::string& str) { textString = str; }
00117 
00122       inline void setStyle(TextStyle& its) { hasOwnStyle = true; textStyle = its; }
00123 
00127       inline void removeStyle() { hasOwnStyle = false; }
00128 
00134       inline void setPosition(double ix, double iy) { x = ix; y = iy; }
00135 
00141       inline void setAlignment(ALIGNMENT align) { textAlign = align; }
00142 
00148       inline void setAngle(int angle) { textAngle = angle; }
00149 
00150 
00151       /*
00152        * Accessors
00153        */
00154 
00156       inline std::string getString(void) const { return textString; }
00157 
00159       inline bool hasOwnTextStyle(void) const { return hasOwnStyle; }
00160 
00162       inline TextStyle getStyle(void) const { return textStyle; }
00163 
00165       inline bool isCenter(void) const { return textAlign == CENTER; }
00166 
00168       inline bool isLeft(void) const { return textAlign == LEFT; }
00169 
00171       inline bool isRight(void) const { return textAlign == RIGHT; }
00172 
00174       inline int getAngle(void) const { return textAngle; }
00175 
00176     protected:
00177 
00178     private:
00179 
00180       std::string textString;
00181       bool hasOwnStyle;
00182       TextStyle textStyle;
00183       ALIGNMENT textAlign;
00184       int textAngle;
00185 
00186   }; // class Text
00187 
00189 
00190 } // namespace vdraw
00191 
00192 #endif //VDRAW_TEXT_H
00193 

Generated on Tue May 22 03:31:02 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1