Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

sxy_chart.h

Go to the documentation of this file.
00001 #ifndef chart_h
00002 #define chart_h
00003 
00004 // =======================================================================
00005 
00006 extern "C" {
00007 #include <iup.h>
00008 #include <cd.h>
00009 }
00010 
00011 #include <xy.h>
00012 
00013 #include "sxy_vector.h"
00014 #include "sxy_graph.h"
00015 #include "sxy_axis.h"
00016 #include "sxy_curve.h"
00017 #include "sxy_area.h"
00018 
00019 class SXYGraph;
00020 class SXYCurve;
00021 class SXYAxis;
00022 
00023 typedef enum {
00024    LINEAR_GRID = 0,
00025    LOG_GRID
00026 } SXYGridType;
00027 
00028 typedef enum {
00029    HORIZONTAL_GRID = 0,
00030    VERTICAL_GRID
00031 } SXYGridOrientation;
00032 
00033 //* Define uma enumeração para a orientação no eixo
00034 typedef enum{
00035   NORMAL_GRID = 1,
00036   INVERTED_GRID = -1
00037 } SXYGridDirection;
00038 
00039 // =======================================================================
00040 //
00041 //* Define o conjunto de objetos xy a ser utilizado pelos gráficos 
00042 class SXYChart {
00043 
00045    double xmulstep;
00046 
00048    double ymulstep;
00049 
00051    SXYGraph* graph;
00052 
00054    XYRasterText* xy_title;
00055 
00057    XYRasterText* xy_subtitle;
00058 
00060    SXYVector<SXYArea*> *areas_vector;
00061 
00063    SXYVector<SXYCurve*> *curves_vector;
00064 
00066    SXYVector<SXYAxis*> *xaxes_vector;
00067 
00069    SXYVector<SXYAxis*> *yaxes_vector;
00070 
00072    XYLegend* xy_legend;
00073 
00075    SXYGridType xgrid_type;
00076 
00078    SXYGridType ygrid_type;
00079 
00081    XYGrid* xy_xgrid;
00082 
00084    XYGrid* xy_ygrid;
00085 
00087    XYCartesian* xy_graph;
00088 
00089    unsigned int getNumCurvesWithAxis(SXYAxis* axis, 
00090          SXYAxisOrientation orientation);
00091 
00092    SXYCurve *getCurveFromAxis(int n, SXYAxis *axis, 
00093          SXYAxisOrientation orientation);
00094 
00095  protected:
00096 
00097 
00098  public:
00099    static int getFontSizeReference(void);
00100    XYCartesian*  getXyGraph(void);
00101    XYRasterText* getXyTitle(void);
00102    XYRasterText* getXySubTitle(void);
00103    void repaintChart(cdCanvas* cnv, SXYGraphDoubleBufferMode mode);
00104    void rebuildMaskArea(void);
00105 
00106    void setLegendVisibility(unsigned int flag);
00107    unsigned int getLegendVisibility(void);
00108    XYLegend* getXyLegend(void);
00109    void getLegendRelativePosition(double& x, double& y);
00110    void setLegendRelativePosition(double x, double y);
00111 
00112    SXYAxis* getAxis(SXYAxisOrientation orientation, unsigned int a);
00113    unsigned int getNumAxes(SXYAxisOrientation orientation);
00114    void insertAxis(SXYAxisOrientation orientation, SXYAxis* axis);
00115    void removeAxis(SXYAxisOrientation orientation, SXYAxis* axis);
00116    
00117    SXYCurve* getCurve(unsigned int c);
00118    unsigned int getNumCurves(void);
00119    void insertCurve(SXYCurve* curve);
00120    void removeCurve(SXYCurve* curve);
00121 
00122    SXYArea* getArea(unsigned int a);
00123    unsigned int getNumAreas(void);
00124    void insertArea(SXYArea* area);
00125    void removeArea(SXYArea* area);
00126 
00127    char* getTitle(void);
00128    void setTitle(char* txt);
00129    void setTitleColor(long int col);
00130    long int getTitleColor(void);
00131 
00132    void setSubTitle(char* txt);
00133    char* getSubTitle(void);
00134    void setSubTitleColor(long int col);
00135    long int getSubTitleColor(void);
00136 
00137    void setBackgroundColor(long int color);
00138    void setGridColor(long int color);
00139    void setMainColor(long int color);
00140    long int getBackgroundColor(void);
00141    long int getMainColor(void);
00142    long int getGridColor(void);
00143 
00144    void setLayoutFrom(SXYChart* other);
00145 
00146    void setGridAutoMultipleStep(SXYGridOrientation orientation, double mulstep);
00147    void setGridSize(SXYGridOrientation orientation, double size);
00148    void setGridPosition(SXYGridOrientation orientation, double xp, double yp);
00149    void setGridDirection(SXYGridOrientation orientation, SXYGridDirection dir);
00150    void setGridType(SXYGridOrientation orientation, SXYGridType type);
00151    void setGridVisibility(SXYGridOrientation orientation, unsigned int flag);
00152    void setGridScales(SXYGridOrientation orientation, double min, double max);
00153    void setGridStep(SXYGridOrientation orientation, double val);
00154    void setZoom(double xratio, double yratio);
00155    void setAllAxis(SXYAxisOrientation orientation, double vmin, double vmax);
00156    void tryGridAdjust(void);
00157    void fitScale(SXYAxisOrientation orientation);
00158 
00159 
00160    double getGridAutoMultipleStep(SXYGridOrientation orientation);
00161    unsigned int getGridVisibility(SXYGridOrientation orientation);
00162    void getGridScales(SXYGridOrientation orientation, double& min, double& max);
00163    double getGridStep(SXYGridOrientation orientation);
00164    SXYGridType getGridType(SXYGridOrientation orientation);
00165    SXYGridDirection getGridDirection(SXYGridOrientation orientation);
00166 
00167    SXYGraph* getGraph(void);
00168 
00169    virtual ~SXYChart();
00170    SXYChart(SXYGraph* gra, double nxmin, double nymin, 
00171       double nxmax, double nymax);
00172 };
00173 
00174 
00175 #endif
00176 

SXY
Tecgraf / PUC-Rio - Computer Graphics Technology Group