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
00075 #ifndef __vtkAxisActor2D_h
00076 #define __vtkAxisActor2D_h
00077
00078 #include "vtkActor2D.h"
00079 #include "vtkPolyDataMapper2D.h"
00080 #include "vtkTextMapper.h"
00081
00082 #define VTK_MAX_LABELS 25
00083
00084 class VTK_RENDERING_EXPORT vtkAxisActor2D : public vtkActor2D
00085 {
00086 public:
00087 vtkTypeMacro(vtkAxisActor2D,vtkActor2D);
00088 void PrintSelf(ostream& os, vtkIndent indent);
00089
00091 static vtkAxisActor2D *New();
00092
00094
00095 vtkViewportCoordinateMacro(Point1);
00097
00099
00102 vtkViewportCoordinateMacro(Point2);
00104
00106
00108 vtkSetVector2Macro(Range,float);
00109 vtkGetVectorMacro(Range,float,2);
00111
00113
00114 vtkSetClampMacro(NumberOfLabels, int, 2, VTK_MAX_LABELS);
00115 vtkGetMacro(NumberOfLabels, int);
00117
00119
00120 vtkSetStringMacro(LabelFormat);
00121 vtkGetStringMacro(LabelFormat);
00123
00125
00128 vtkSetMacro(AdjustLabels, int);
00129 vtkGetMacro(AdjustLabels, int);
00130 vtkBooleanMacro(AdjustLabels, int);
00132
00134
00135 vtkSetStringMacro(Title);
00136 vtkGetStringMacro(Title);
00138
00140
00141 vtkSetMacro(Bold, int);
00142 vtkGetMacro(Bold, int);
00143 vtkBooleanMacro(Bold, int);
00145
00147
00148 vtkSetMacro(Italic, int);
00149 vtkGetMacro(Italic, int);
00150 vtkBooleanMacro(Italic, int);
00152
00154
00156 vtkSetMacro(Shadow, int);
00157 vtkGetMacro(Shadow, int);
00158 vtkBooleanMacro(Shadow, int);
00160
00162
00165 vtkSetMacro(FontFamily, int);
00166 vtkGetMacro(FontFamily, int);
00167 void SetFontFamilyToArial() {this->SetFontFamily(VTK_ARIAL);};
00168 void SetFontFamilyToCourier() {this->SetFontFamily(VTK_COURIER);};
00169 void SetFontFamilyToTimes() {this->SetFontFamily(VTK_TIMES);};
00171
00173
00175 vtkSetClampMacro(TickLength, int, 0, 100);
00176 vtkGetMacro(TickLength, int);
00178
00180
00183 vtkSetClampMacro(TickOffset, int, 0, 100);
00184 vtkGetMacro(TickOffset, int);
00186
00188
00189 vtkSetMacro(AxisVisibility, int);
00190 vtkGetMacro(AxisVisibility, int);
00191 vtkBooleanMacro(AxisVisibility, int);
00193
00195
00196 vtkSetMacro(TickVisibility, int);
00197 vtkGetMacro(TickVisibility, int);
00198 vtkBooleanMacro(TickVisibility, int);
00200
00202
00203 vtkSetMacro(LabelVisibility, int);
00204 vtkGetMacro(LabelVisibility, int);
00205 vtkBooleanMacro(LabelVisibility, int);
00207
00209
00210 vtkSetMacro(TitleVisibility, int);
00211 vtkGetMacro(TitleVisibility, int);
00212 vtkBooleanMacro(TitleVisibility, int);
00214
00216
00219 vtkSetClampMacro(FontFactor, float, 0.1, 2.0);
00220 vtkGetMacro(FontFactor, float);
00222
00224
00226 vtkSetClampMacro(LabelFactor, float, 0.1, 2.0);
00227 vtkGetMacro(LabelFactor, float);
00229
00231
00232 int RenderOverlay(vtkViewport* viewport);
00233 int RenderOpaqueGeometry(vtkViewport* viewport);
00234 int RenderTranslucentGeometry(vtkViewport *) {return 0;}
00236
00240 void ReleaseGraphicsResources(vtkWindow *);
00241
00243
00251 static void ComputeRange(float inRange[2], float outRange[2],
00252 int inNumTicks, int &outNumTicks, float &interval);
00254
00256
00263 static int SetFontSize(vtkViewport *viewport, vtkTextMapper *textMapper,
00264 int *size, float factor,
00265 int &stringWidth, int &stringHeight);
00267
00269 void ShallowCopy(vtkProp *prop);
00270
00271 protected:
00272 vtkAxisActor2D();
00273 ~vtkAxisActor2D();
00274
00275 vtkCoordinate *Point1Coordinate;
00276 vtkCoordinate *Point2Coordinate;
00277 char *Title;
00278 float Range[2];
00279 int NumberOfLabels;
00280 char *LabelFormat;
00281 int NumberOfLabelsBuilt;
00282 int AdjustLabels;
00283 float FontFactor;
00284 float LabelFactor;
00285 int TickLength;
00286 int TickOffset;
00287
00288 int Bold;
00289 int Italic;
00290 int Shadow;
00291 int FontFamily;
00292
00293 int AxisVisibility;
00294 int TickVisibility;
00295 int LabelVisibility;
00296 int TitleVisibility;
00297
00298 int LastPoint1[2];
00299 int LastPoint2[2];
00300
00301 int LastSize[2];
00302 int LastTitleFontSize;
00303 int LastLabelFontSize;
00304
00305 virtual void BuildAxis(vtkViewport *viewport);
00306 static float ComputeStringOffset(float width, float height, float theta);
00307 static void SetOffsetPosition(float xTick[3], float theta, int stringHeight,
00308 int stringWidth, int offset, vtkActor2D *actor);
00309
00310 vtkTextMapper *TitleMapper;
00311 vtkActor2D *TitleActor;
00312
00313 vtkTextMapper **LabelMappers;
00314 vtkActor2D **LabelActors;
00315
00316 vtkPolyData *Axis;
00317 vtkPolyDataMapper2D *AxisMapper;
00318 vtkActor2D *AxisActor;
00319
00320 vtkTimeStamp BuildTime;
00321 private:
00322 vtkAxisActor2D(const vtkAxisActor2D&);
00323 void operator=(const vtkAxisActor2D&);
00324 };
00325
00326
00327 #endif