Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

FXAxis.h

00001 /*******************************************************************************
00002 * Copyright (C) 2003-2005 by Rafael de Pelegrini Soares.   All Rights Reserved.
00003 ********************************************************************************
00004 * This library is free software; you can redistribute it and/or
00005 * modify it under the terms of the GNU Lesser General Public
00006 * License as published by the Free Software Foundation; either
00007 * version 2.1 of the License, or (at your option) any later version.
00008 *
00009 * This library is distributed in the hope that it will be useful,
00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00012 * Lesser General Public License for more details.
00013 *
00014 * You should have received a copy of the GNU Lesser General Public
00015 * License along with this library; if not, write to the Free Software
00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
00017 ********************************************************************************
00018 * $Id: FXAxis.h,v 1.2 2006/01/12 17:57:08 rpseng Exp $
00019 ********************************************************************************/
00020  
00021  
00022 #ifndef __FXAXIS_H
00023 #define __FXAXIS_H
00024 
00025 #include "FXPlotBase.h"
00026 #include <vector>
00027 
00028 // Forward declaration
00029 class FXPlot2D;
00030 
00032 struct FXAxisMark
00033 {
00035         FXString label;
00037         FXString exp;
00039         FXint w;
00041         FXint we;
00042 };
00043 
00044 
00056 class FXAxis
00057 {
00058 protected:
00060         FXPlot2D *plot;
00061 
00063         double min;
00065         double max;
00067         double step;
00069         double minmark;
00071         double maxmark;
00072 
00074         double cnv;
00075 
00077         FXPoint p1, p2;
00079         FXint y1, y2;
00080 
00081         FXint prec; //precision of this axis
00083         FXuint maxMajor;
00085         FXuint maxMinor;
00087         FXint markwidth;
00088 
00090         FXFont *font;
00092         FXFont *fontmini;
00093 
00095         std::vector<FXAxisMark> marks;
00096 
00098         FXint flags;
00099 
00101         FXString label;
00102 public:
00108         FXAxis(FXPlot2D *p, FXint flags = Bottom|Enabled|Linear|MajorThicks);
00109 
00111         virtual ~FXAxis();
00112 
00114         FXint transform(double value) const;
00115 
00119         double backTransform(FXint y) const;
00120 
00124         FXbool contains(double value) const;
00125 
00127         void recalcule(void);
00128 
00132         double getMin() const;
00133 
00137         double getMax() const;
00138 
00143         void setRange(double min, double max);
00144 
00149         void setPosition(FXPoint p1, FXPoint p2);
00150 
00155         void zoomIn(FXint x);
00156 
00161         void zoomOut(void);
00162 
00164         void drawSelf(FXDC *dc, FXint rootx, FXint rooty);
00165 
00167         void setFlags(FXint flag);
00168 
00170         FXint getFlags(void) const;
00171 
00173         void setLabel(const FXString &name);
00174 
00176         const FXString& getLabel() const{
00177                 return label;
00178         }
00179 
00180         //layout stuff
00181         FXint getDefaultHeight();
00182         FXint getDefaultWidth();
00183 
00184         //create the fonts and etc.
00185         void create();
00186 
00188         enum Orientation{
00189                 Bottom = 0x0001,
00190                 Left   = 0x0002,
00191                 Right  = 0x0004,
00192                 Top    = 0x0008,
00193         };
00194 
00196         enum Style{
00197                 Linear        = 0x0010,
00198                 Logarithimic  = 0x0020,
00199         };
00200 
00202         enum Status {
00203                 Enabled  = 0x0100,
00204                 Disabled = 0x0200,
00205         };
00206 
00208         enum GridFlags{
00209                 MinorThicks = 0x1000,
00210                 MajorThicks = 0x2000,
00211                 MinorGrid   = 0x4000,
00212                 MajorGrid   = 0x8000,
00213         };
00214 protected:
00216         void buildThicksLinear();
00218         void buildThicksLog();
00219 
00220 };
00221 
00222 #endif // __FXAXIS_H
00223 

Generated on Tue Jan 31 10:55:30 2006 for FXPlot by  doxygen 1.4.4