00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00077 #ifndef __vtkAxisActor2D_h
00078 #define __vtkAxisActor2D_h
00079
00080 #include "vtkActor2D.h"
00081 #include "vtkPolyDataMapper2D.h"
00082 #include "vtkTextMapper.h"
00083
00084 #define VTK_MAX_LABELS 25
00085
00086 class VTK_EXPORT vtkAxisActor2D : public vtkActor2D
00087 {
00088 public:
00089 vtkTypeMacro(vtkAxisActor2D,vtkActor2D);
00090 void PrintSelf(ostream& os, vtkIndent indent);
00091
00093 static vtkAxisActor2D *New();
00094
00096 vtkViewportCoordinateMacro(Point1);
00097
00101 vtkViewportCoordinateMacro(Point2);
00102
00105 vtkSetVector2Macro(Range,float);
00106 vtkGetVectorMacro(Range,float,2);
00107
00109 vtkSetClampMacro(NumberOfLabels, int, 2, VTK_MAX_LABELS);
00110 vtkGetMacro(NumberOfLabels, int);
00111
00113 vtkSetStringMacro(LabelFormat);
00114 vtkGetStringMacro(LabelFormat);
00115
00119 vtkSetMacro(AdjustLabels, int);
00120 vtkGetMacro(AdjustLabels, int);
00121 vtkBooleanMacro(AdjustLabels, int);
00122
00124 vtkSetStringMacro(Title);
00125 vtkGetStringMacro(Title);
00126
00128 vtkSetMacro(Bold, int);
00129 vtkGetMacro(Bold, int);
00130 vtkBooleanMacro(Bold, int);
00131
00133 vtkSetMacro(Italic, int);
00134 vtkGetMacro(Italic, int);
00135 vtkBooleanMacro(Italic, int);
00136
00139 vtkSetMacro(Shadow, int);
00140 vtkGetMacro(Shadow, int);
00141 vtkBooleanMacro(Shadow, int);
00142
00146 vtkSetMacro(FontFamily, int);
00147 vtkGetMacro(FontFamily, int);
00148 void SetFontFamilyToArial() {this->SetFontFamily(VTK_ARIAL);};
00149 void SetFontFamilyToCourier() {this->SetFontFamily(VTK_COURIER);};
00150 void SetFontFamilyToTimes() {this->SetFontFamily(VTK_TIMES);};
00151
00154 vtkSetClampMacro(TickLength, int, 0, 100);
00155 vtkGetMacro(TickLength, int);
00156
00160 vtkSetClampMacro(TickOffset, int, 0, 100);
00161 vtkGetMacro(TickOffset, int);
00162
00164 vtkSetMacro(AxisVisibility, int);
00165 vtkGetMacro(AxisVisibility, int);
00166 vtkBooleanMacro(AxisVisibility, int);
00167
00169 vtkSetMacro(TickVisibility, int);
00170 vtkGetMacro(TickVisibility, int);
00171 vtkBooleanMacro(TickVisibility, int);
00172
00174 vtkSetMacro(LabelVisibility, int);
00175 vtkGetMacro(LabelVisibility, int);
00176 vtkBooleanMacro(LabelVisibility, int);
00177
00179 vtkSetMacro(TitleVisibility, int);
00180 vtkGetMacro(TitleVisibility, int);
00181 vtkBooleanMacro(TitleVisibility, int);
00182
00186 vtkSetClampMacro(FontFactor, float, 0.1, 2.0);
00187 vtkGetMacro(FontFactor, float);
00188
00191 vtkSetClampMacro(LabelFactor, float, 0.1, 2.0);
00192 vtkGetMacro(LabelFactor, float);
00193
00195 int RenderOverlay(vtkViewport* viewport);
00196 int RenderOpaqueGeometry(vtkViewport* viewport);
00197 int RenderTranslucentGeometry(vtkViewport *) {return 0;}
00198
00202 void ReleaseGraphicsResources(vtkWindow *);
00203
00212 static void ComputeRange(float inRange[2], float outRange[2],
00213 int inNumTicks, int &outNumTicks, float &interval);
00214
00222 static int SetFontSize(vtkViewport *viewport, vtkTextMapper *textMapper,
00223 int *size, float factor,
00224 int &stringWidth, int &stringHeight);
00225
00227 void ShallowCopy(vtkProp *prop);
00228
00229 protected:
00230 vtkAxisActor2D();
00231 ~vtkAxisActor2D();
00232 vtkAxisActor2D(const vtkAxisActor2D&) {};
00233 void operator=(const vtkAxisActor2D&) {};
00234
00235 vtkCoordinate *Point1Coordinate;
00236 vtkCoordinate *Point2Coordinate;
00237 char *Title;
00238 float Range[2];
00239 int NumberOfLabels;
00240 char *LabelFormat;
00241 int NumberOfLabelsBuilt;
00242 int AdjustLabels;
00243 float FontFactor;
00244 float LabelFactor;
00245 int TickLength;
00246 int TickOffset;
00247
00248 int Bold;
00249 int Italic;
00250 int Shadow;
00251 int FontFamily;
00252
00253 int AxisVisibility;
00254 int TickVisibility;
00255 int LabelVisibility;
00256 int TitleVisibility;
00257
00258 int LastPoint1[2];
00259 int LastPoint2[2];
00260
00261 int LastSize[2];
00262 int LastTitleFontSize;
00263 int LastLabelFontSize;
00264
00265 private:
00266 void BuildAxis(vtkViewport *viewport);
00267 static float ComputeStringOffset(float width, float height, float theta);
00268 static void SetOffsetPosition(float xTick[3], float theta, int stringHeight,
00269 int stringWidth, int offset, vtkActor2D *actor);
00270
00271 vtkTextMapper *TitleMapper;
00272 vtkActor2D *TitleActor;
00273
00274 vtkTextMapper **LabelMappers;
00275 vtkActor2D **LabelActors;
00276
00277 vtkPolyData *Axis;
00278 vtkPolyDataMapper2D *AxisMapper;
00279 vtkActor2D *AxisActor;
00280
00281 vtkTimeStamp BuildTime;
00282 };
00283
00284
00285 #endif