00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00025 #ifndef __vtkAxis_h
00026 #define __vtkAxis_h
00027
00028 #include "vtkContextItem.h"
00029 #include "vtkSmartPointer.h"
00030
00031 class vtkContext2D;
00032 class vtkPen;
00033 class vtkFloatArray;
00034 class vtkDoubleArray;
00035 class vtkStringArray;
00036 class vtkTextProperty;
00037
00038 class VTK_CHARTS_EXPORT vtkAxis : public vtkContextItem
00039 {
00040 public:
00041 vtkTypeMacro(vtkAxis, vtkContextItem);
00042 virtual void PrintSelf(ostream &os, vtkIndent indent);
00043
00044
00046
00048 enum {
00049 LEFT = 0,
00050 BOTTOM,
00051 RIGHT,
00052 TOP,
00053 PARALLEL
00054 };
00056
00057
00059 static vtkAxis *New();
00060
00062
00063 vtkSetMacro(Position, int);
00064 vtkGetMacro(Position, int);
00066
00068
00069 vtkSetVector2Macro(Point1, float);
00071
00073
00074 vtkGetVector2Macro(Point1, float);
00076
00078
00079 vtkSetVector2Macro(Point2, float);
00081
00083
00084 vtkGetVector2Macro(Point2, float);
00086
00088
00089 vtkSetMacro(NumberOfTicks, int);
00091
00093
00094 vtkGetMacro(NumberOfTicks, int);
00096
00098
00100 vtkGetObjectMacro(LabelProperties, vtkTextProperty);
00102
00104 virtual void SetMinimum(double minimum);
00105
00107
00108 vtkGetMacro(Minimum, double);
00110
00112 virtual void SetMaximum(double maximum);
00113
00115
00116 vtkGetMacro(Maximum, double);
00118
00120 virtual void SetRange(double minimum, double maximum);
00121
00123
00124 vtkSetStringMacro(Title);
00125 vtkGetStringMacro(Title);
00127
00129
00130 vtkGetObjectMacro(TitleProperties, vtkTextProperty);
00132
00134
00135 vtkSetMacro(LogScale, bool);
00136 vtkGetMacro(LogScale, bool);
00138
00140
00141 vtkSetMacro(GridVisible, bool);
00142 vtkGetMacro(GridVisible, bool);
00144
00146
00147 vtkSetMacro(LabelsVisible, bool);
00148 vtkGetMacro(LabelsVisible, bool);
00150
00152
00153 virtual void SetPrecision(int precision);
00154 vtkGetMacro(Precision, int);
00156
00158
00160 virtual void SetNotation(int notation);
00161 vtkGetMacro(Notation, int);
00163
00165
00167 vtkSetMacro(Behavior, int);
00168 vtkGetMacro(Behavior, int);
00170
00172
00174 vtkGetObjectMacro(Pen, vtkPen);
00176
00178
00180 vtkGetObjectMacro(GridPen, vtkPen);
00182
00185 virtual void Update();
00186
00188 virtual bool Paint(vtkContext2D *painter);
00189
00194 virtual void AutoScale();
00195
00198 virtual void RecalculateTickSpacing();
00199
00202 virtual vtkDoubleArray* GetTickPositions();
00203
00205 virtual void SetTickPositions(vtkDoubleArray*);
00206
00209 virtual vtkFloatArray* GetTickScenePositions();
00210
00212 virtual vtkStringArray* GetTickLabels();
00213
00215 virtual void SetTickLabels(vtkStringArray*);
00216
00217
00218 protected:
00219 vtkAxis();
00220 ~vtkAxis();
00221
00223 void GenerateTickLabels(double min, double max);
00224
00227 double CalculateNiceMinMax(double &min, double &max);
00228
00232 double NiceNumber(double number, bool roundUp);
00233
00234 int Position;
00235 float Point1[2];
00236 float Point2[2];
00237 double TickInterval;
00238 int NumberOfTicks;
00239 vtkTextProperty* LabelProperties;
00240 double Minimum;
00241 double Maximum;
00242 char* Title;
00243 vtkTextProperty* TitleProperties;
00244 bool LogScale;
00245 bool GridVisible;
00246 bool LabelsVisible;
00247 int Precision;
00248 int Notation;
00249 int Behavior;
00250
00252 vtkPen* Pen;
00253
00256 vtkPen* GridPen;
00257
00259 vtkSmartPointer<vtkDoubleArray> TickPositions;
00260
00262 vtkSmartPointer<vtkFloatArray> TickScenePositions;
00263
00265 vtkSmartPointer<vtkStringArray> TickLabels;
00266
00269 bool UsingNiceMinMax;
00270
00272 bool TickMarksDirty;
00273
00275 vtkTimeStamp BuildTime;
00276
00277 private:
00278 vtkAxis(const vtkAxis &);
00279 void operator=(const vtkAxis &);
00280
00281 };
00282
00283 #endif //__vtkAxis_h