wxChart.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   wxMaracas
00004   Module:    $RCSfile: wxChart.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009/05/14 13:54:57 $
00007   Version:   $Revision: 1.1 $
00008 
00009   Copyright: (c) 2002, 2003
00010   License:
00011   
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notice for more information.
00015 
00016 =========================================================================*/
00017 
00018 #ifndef __WX__MARACAS__CHART__HXX__
00019 #define __WX__MARACAS__CHART__HXX__
00020 
00021 #include <wx/wx.h>
00022 
00023 //---------------------------------------------------------------------
00024 #define MAX_DATASET   10
00025 #define MAX_ITEM      50 
00026 #define MARGE              5
00027 #define MINOR_STEP    10
00028 #define MAJOR_STEP     5
00029 #define MAX_PER      200 
00030 #define MINOR_PER     25
00031 #define MAJOR_PER     50
00032         
00033 enum 
00034 {
00035   wxArea              = 0,
00036   wxPerimeter         = 1,
00037   wxDiameterArea      = 2, 
00038   wxDiameterPerimeter = 3,
00039   wxMinimumDiameter   = 4,
00040   wxMaximumDiameter   = 5,
00041   wxAverageDiameter   = 6,
00042   wxStenosis          = 7
00043 };
00044 
00045 
00046 //-------------------------------------------------------------------
00047 class wxDataSet: public wxObject
00048 {
00049  protected:
00050    wxBrush  *m_dataStyle;
00051    wxPen    *m_lineStyle;
00052    wxString *m_text;
00053    int       m_dataWidth;     // Scaled|Fixed
00054    int       m_lineWidth;
00055    int       m_pointMark;
00056    int       m_displayValues; // def=NONE |IN | OUT 
00057    bool      m_display;
00058 
00059  public:
00060    wxList *m_rowsList;
00061  
00062  public :
00063    // Constructor & Destructor
00064    wxDataSet(wxPen *lStype, wxBrush *dStyle,
00065              int dWidth, int lWidth, int dGap, int pMark,
00066              int disValues);
00067    wxDataSet(wxPen *lStype, wxBrush *dStyle,
00068              wxString *lText, bool lDisplay=false);
00069    wxDataSet();
00070    ~wxDataSet();
00071  
00072     // Set
00073    void SetDataStyle(wxBrush* brush)  { m_dataStyle = brush; }
00074    void SetDataWidth(int width)       { m_dataWidth = width; }
00075    void SetLineStyle(wxPen* style)    { m_lineStyle = style; }
00076    void SetPointMark(int mark)        { m_pointMark = mark;  }
00077    void SetText(wxString* string)     { m_text      = string;}
00078    void Show(bool show)               { m_display   = show;  }
00079    
00080    // Get
00081    bool      GetShow()                { return m_display;    }
00082    wxBrush*  GetDataStyle()           { return m_dataStyle;  }
00083    int       GetDataWidth()           { return m_dataWidth;  }
00084    wxPen*    GetLineStyle()           { return m_lineStyle;  }
00085    int       GetPointMark()           { return m_pointMark;  }
00086    wxString* GetText()                { return m_text;       }
00087    
00088 };
00089 //---------------------------------------------------------------
00090 
00091 
00092 class Table
00093 {
00094   public :
00095     double x,y;
00096         bool   empty;
00097 };
00098 
00099 //----------------------------------------------------------------------
00100 class wxChart: public wxPanel
00101 {
00102 private:
00103         
00104     int         m_NumDataSet;
00105         int         m_NumItem;
00106         Table       m_table[MAX_DATASET][MAX_ITEM];
00107     wxDataSet  *m_dataSetArray[MAX_DATASET]; 
00108  
00109     double      m_MinX, m_MaxX;
00110     double      m_InfX, m_SupX, m_SupY;
00111         
00112         double      m_StepSizeX, m_StepSizeY, m_StepSizePer;
00113     double      m_MaxValue; 
00114     
00115         double      m_MinorIncX, m_MajorIncX;
00116     double      m_MinorIncY, m_MajorIncY;
00117 
00118     bool        m_ShowPer;
00119 
00120         int         m_ValueCol;  
00121 
00122         int         m_MaxHauteur, m_MaxLargeur;
00123     int         m_CenterX, m_CenterY;
00124         int         m_EdgeTop, m_EdgeBottom, m_EdgeLeft, m_EdgeRight;
00125     int         m_Top,m_Bottom, m_Left, m_Right;
00126             
00127     int         m_EdgeTopLegend, m_EdgeBottomLegend, m_EdgeLeftLegend, m_EdgeRightLegend;
00128     int         m_TopLegend, m_BottomLegend, m_LeftLegend, m_RightLegend;
00129         
00130         void        DrawLine(wxDC &dc, int a);
00131         void        DrawFond(wxDC& dc);
00132     void        DrawAxe(wxDC& dc);
00133     void        DrawAxePer(wxDC& dc);
00134         void        DrawLegend(wxDC& dc, int nbr);
00135         void        DrawGrille(wxDC& dc);
00136         void        SetInitEdge();
00137     void        SetChartBounds();
00138         void        SetChartBoundsLegend();
00139         void        SetCadreLegend(int nbr, int* bottom);
00140     void        InitDataSet();
00141     void        InitData();
00142         double      MaxValue();
00143         double      MinCol(double inf);
00144     double      MaxCol(double sup);
00145     void        SetInfX(double sup);
00146         void        SetSupX(double sup);
00147         void        SetSupY(double sup);
00148     void        InitChart();
00149     int         GetShow();
00150 
00151 public:
00152         // Constructor et Destructor
00153         wxChart(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
00154                 const wxSize& size = wxDefaultSize, long  style = wxDEFAULT_FRAME_STYLE,
00155                 const wxString& name = wxPanelNameStr);
00156     ~wxChart();
00157         
00158         void    OnPaint(wxPaintEvent& event);
00159         void    OnLeftClick(wxDC &dc, double x, double y, int keys);
00160         void    OnRightClick(wxDC &dc, double x, double y, int keys);
00161         
00162         void    Draw(wxDC& dc);
00163         bool    IsEmpty(int a, int item);
00164         double  GetDataX(int a, int item);
00165         double  GetDataY(int a, int item);
00166     void    SetData(int a, int item, double x, double y);
00167     
00168     void    SetMinX(double MinX);
00169         void    SetMaxX(double MaxX);
00170         void    SetMaxWidthHeight(int x,int y); 
00171         void    SetCenterChart(int x, int y);
00172         void    SetShowPer(bool per);
00173         void    SetMaxValue(double max);
00174         void    SetStepSizeX(double sizeX);
00175     void    SetStepSizeY(double sizeY);
00176     void    SetStepSizePer(double sizePer);
00177     void    SetNumDataSet(int NumDataSet);
00178         void    SetNumItem(int NumItem);
00179         void    SetIncAxisX(double minor, double major);
00180     void    SetIncAxisY(double minor, double major);
00181     void    SetEdgeTop(int top);
00182         void    SetEdgeBottom(int bottom);
00183         void    SetEdgeLeft(int left);
00184         void    SetEdgeRight(int right);
00185     void    SetEdgeTopLegend(int top);
00186         void    SetEdgeBottomLegend(int bottom);
00187         void    SetEdgeLeftLegend(int left);
00188         void    SetEdgeRightLegend(int right);
00189         void    ShowDataSet(bool show,int dataset);
00190         
00191         bool    GetShowDataSet(int dataset);
00192     double  GetMinX()             { return m_MinX;             }
00193     double  GetMaxX()             { return m_MaxX;             }
00194         int     GetMaxValue()         { return (int)m_MaxValue;         }
00195         double  GetStepSizeX()        { return m_StepSizeX;        }
00196     double  GetStepSizeY()        { return m_StepSizeY;        }
00197     double  GetStepSizePer()      { return m_StepSizePer;      }
00198     int     GetValueCol()         { return m_ValueCol;         }
00199     int     GetNumDataSet()       { return m_NumDataSet;       }
00200         int     GetNumItem()          { return m_NumItem;          }
00201         bool    GetShowPer()          { return m_ShowPer;          }
00202         int     GetLargeur()          { return m_MaxLargeur;       }
00203     int     GetHauteur()          { return m_MaxHauteur;       }
00204         int     GetEdgeTop()          { return m_EdgeTop;          }
00205     int     GetEdgeBottom()       { return m_EdgeBottom;       }
00206     int     GetEdgeLeft()         { return m_EdgeLeft;         }
00207     int     GetEdgeRight()        { return m_EdgeRight;        }
00208         int     GetEdgeTopLegend()    { return m_EdgeTopLegend;    }
00209     int     GetEdgeBottomLegend() { return m_EdgeBottomLegend; }
00210     int     GetEdgeLeftLegend()   { return m_EdgeLeftLegend;   }
00211     int     GetEdgeRightLegend()  { return m_EdgeRightLegend;  }
00212         
00213    DECLARE_EVENT_TABLE()
00214 };
00215 
00216 
00217 
00218 #endif 
00219 

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1