00001 #ifndef axis_h
00002 #define axis_h
00003
00004
00005
00006 extern "C" {
00007 #include <iup.h>
00008 #include <cd.h>
00009 }
00010
00011 #include <xy.h>
00012
00013
00014 class SXYChart;
00015
00016
00017
00018
00019
00020
00021 typedef enum{
00022 HORIZONTAL_AXIS = 0,
00023 VERTICAL_AXIS
00024 } SXYAxisOrientation;
00025
00026
00027 typedef enum{
00028 LINEAR_AXIS = 0,
00029 LOG_AXIS,
00030 TIME_AXIS
00031 } SXYAxisType;
00032
00033
00034 typedef enum{
00035 NORMAL_AXIS = 1,
00036 INVERTED_AXIS = -1
00037 } SXYAxisDirection;
00038
00039
00040 typedef enum{
00041 AT_MIDDLE = 0,
00042 AT_END,
00043 AT_END_ROTATED,
00044 } SXYAxisTitleStyle;
00045
00046
00047 typedef enum{
00048 ALIGNED = 0,
00049 ROTATED
00050 } SXYAxisScaleOrientation;
00051
00052
00053
00054
00055
00056 class SXYAxis {
00057
00059 SXYChart* chart;
00060
00062 SXYAxisType type;
00063
00065 SXYAxisTitleStyle title_style;
00066
00068 SXYAxisScaleOrientation scale_orientation;
00069
00071 SXYAxisOrientation orientation;
00072
00074 XYRasterText* xy_label;
00075
00077 XYRasterText* xy_decor_text;
00078
00080 XYScaleDecorator* xy_decor;
00081
00083 XYAxis* xy_axis;
00084
00086 int precision;
00087
00088 protected:
00089
00090 void updateTitleStyle(void);
00091 void updateScaleOrientation(void);
00092 void buildDecoratorAxis(double angle, double xpos, double ypos, double size);
00093
00094 public:
00095
00096 XYAxis* getXyAxis(void);
00097 XYRasterText* getXyTitle(void);
00098 XYRasterText* getXyDecorator(void);
00099
00100 SXYChart* getChart(void);
00101 SXYAxisType getType(void);
00102 SXYAxisOrientation getOrientation(void);
00103
00104 void setLayoutFrom(SXYAxis* other);
00105
00106
00107 int getPixelValue( double position );
00108 double getPositionValue( int pixel );
00109
00110 void setTitle(char* txt);
00111 char* getTitle(void);
00112
00113 void setColor(long int col);
00114 long int getColor(void);
00115
00116 void setTitleColor(long int col);
00117 long int getTitleColor(void);
00118
00119 void setDirection(SXYAxisDirection dir);
00120 SXYAxisDirection getDirection(void);
00121
00122 void setTitleStyle(SXYAxisTitleStyle sty);
00123 SXYAxisTitleStyle getTitleStyle(void);
00124
00125 void setScaleOrientation(SXYAxisScaleOrientation ori);
00126 SXYAxisScaleOrientation getScaleOrientation(void);
00127
00128 void setScaleColor(long int col);
00129 long int getScaleColor(void);
00130
00131 void setPosition(double posx, double posy);
00132 void getPosition(double& posx, double& posy);
00133
00134 void setArrowVisibility(int vis);
00135 int getArrowVisibility(void);
00136
00137 void setSize(double siz);
00138 double getSize(void);
00139
00140 void setVisibility(int flag);
00141 int getVisibility(void);
00142
00143 void setFormat(char* fmt);
00144 char* getFormat(void);
00145
00146 void tryScalesAdjust(void);
00147 void tryStepAdjust(void);
00148 void setScales(double minimum, double maximum);
00149 void setStep(double step);
00150 void calcPrecision();
00151 void setPrecision(int p);
00152
00153 void getScales(double& minimum, double& maximum);
00154 double getStep(void);
00155 void setZoom(double ratio);
00156
00157 virtual ~SXYAxis();
00158 SXYAxis(SXYChart* cht, SXYAxisOrientation ori, SXYAxisType typ,
00159 double xpos, double ypos, double size);
00160 };
00161
00162
00163 #endif
00164