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
00096 #ifndef __vtkXYPlotActor_h
00097 #define __vtkXYPlotActor_h
00098
00099 #define VTK_XYPLOT_INDEX 0
00100 #define VTK_XYPLOT_ARC_LENGTH 1
00101 #define VTK_XYPLOT_NORMALIZED_ARC_LENGTH 2
00102 #define VTK_XYPLOT_VALUE 3
00103
00104 #define VTK_XYPLOT_ROW 0
00105 #define VTK_XYPLOT_COLUMN 1
00106
00107 #include "vtkAxisActor2D.h"
00108 class vtkDataSetCollection;
00109 class vtkDataObjectCollection;
00110 class vtkGlyphSource2D;
00111 class vtkGlyph2D;
00112 class vtkLegendBoxActor;
00113 class vtkAppendPolyData;
00114 class vtkPlanes;
00115 class vtkIntArray;
00116
00117 class VTK_EXPORT vtkXYPlotActor : public vtkActor2D
00118 {
00119 public:
00120 vtkTypeMacro(vtkXYPlotActor,vtkActor2D);
00121 void PrintSelf(ostream& os, vtkIndent indent);
00122
00127 static vtkXYPlotActor *New();
00128
00129
00130
00131
00132
00133
00135 void AddInput(vtkDataSet *in);
00136
00138 void RemoveInput(vtkDataSet *in);
00139
00141 vtkDataSetCollection *GetInputList() {return this->InputList;}
00142
00146 void SetPointComponent(int i, int comp);
00147 int GetPointComponent(int i);
00148
00149
00158 vtkSetClampMacro(XValues,int,VTK_XYPLOT_INDEX,VTK_XYPLOT_VALUE);
00159 vtkGetMacro(XValues,int);
00160 void SetXValuesToIndex(){this->SetXValues(VTK_XYPLOT_INDEX);};
00161 void SetXValuesToArcLength() {this->SetXValues(VTK_XYPLOT_ARC_LENGTH);};
00162 void SetXValuesToNormalizedArcLength()
00163 {this->SetXValues(VTK_XYPLOT_NORMALIZED_ARC_LENGTH);};
00164 void SetXValuesToValue() {this->SetXValues(VTK_XYPLOT_VALUE);};
00165 const char *GetXValuesAsString();
00166
00167
00168
00169
00170
00171
00173 void AddDataObjectInput(vtkDataObject *in);
00174
00176 void RemoveDataObjectInput(vtkDataObject *in);
00177
00179 vtkDataObjectCollection *GetDataObjectInputList()
00180 {return this->DataObjectInputList;}
00181
00184 vtkSetClampMacro(DataObjectPlotMode,int,VTK_XYPLOT_COLUMN,VTK_XYPLOT_ROW);
00185 vtkGetMacro(DataObjectPlotMode,int);
00186 void SetDataObjectPlotModeToRows()
00187 {this->SetDataObjectPlotMode(VTK_XYPLOT_ROW);}
00188 void SetDataObjectPlotModeToColumns()
00189 {this->SetDataObjectPlotMode(VTK_XYPLOT_COLUMN);}
00190 const char *GetDataObjectPlotModeAsString();
00191
00198 void SetDataObjectXComponent(int i, int comp);
00199 int GetDataObjectXComponent(int i);
00200
00207 void SetDataObjectYComponent(int i, int comp);
00208 int GetDataObjectYComponent(int i);
00209
00210
00211
00212
00213
00214
00215
00216 void SetPlotColor(int i, float r, float g, float b);
00217 void SetPlotColor(int i, float color[3]);
00218 float *GetPlotColor(int i);
00219 void SetPlotSymbol(int i,vtkPolyData *input);
00220 vtkPolyData *GetPlotSymbol(int i);
00221 void SetPlotLabel(int i, const char *label);
00222 const char *GetPlotLabel(int i);
00223
00224
00229 vtkLegendBoxActor *GetLegendBoxActor()
00230 {return this->LegendActor;}
00231 vtkGlyphSource2D *GetGlyphSource()
00232 {return this->GlyphSource;}
00233
00236 vtkSetStringMacro(Title);
00237 vtkGetStringMacro(Title);
00238 vtkSetStringMacro(XTitle);
00239 vtkGetStringMacro(XTitle);
00240 vtkSetStringMacro(YTitle);
00241 vtkGetStringMacro(YTitle);
00242
00249 vtkSetVector2Macro(XRange,float);
00250 vtkGetVectorMacro(XRange,float,2);
00251 vtkSetVector2Macro(YRange,float);
00252 vtkGetVectorMacro(YRange,float,2);
00253 void SetPlotRange(float xmin, float ymin, float xmax, float ymax)
00254 {this->SetXRange(xmin,xmax); this->SetYRange(ymin,ymax);}
00255
00261 vtkSetClampMacro(NumberOfXLabels, int, 0, 50);
00262 vtkGetMacro(NumberOfXLabels, int);
00263 vtkSetClampMacro(NumberOfYLabels, int, 0, 50);
00264 vtkGetMacro(NumberOfYLabels, int);
00265 void SetNumberOfLabels(int num)
00266 {this->SetNumberOfXLabels(num); this->SetNumberOfYLabels(num);}
00267
00271 vtkSetMacro(Legend, int);
00272 vtkGetMacro(Legend, int);
00273 vtkBooleanMacro(Legend, int);
00274
00281 vtkSetVector2Macro(LegendPosition,float);
00282 vtkGetVector2Macro(LegendPosition,float);
00283 vtkSetVector2Macro(LegendPosition2,float);
00284 vtkGetVector2Macro(LegendPosition2,float);
00285
00287 vtkSetMacro(Bold, int);
00288 vtkGetMacro(Bold, int);
00289 vtkBooleanMacro(Bold, int);
00290
00292 vtkSetMacro(Italic, int);
00293 vtkGetMacro(Italic, int);
00294 vtkBooleanMacro(Italic, int);
00295
00298 vtkSetMacro(Shadow, int);
00299 vtkGetMacro(Shadow, int);
00300 vtkBooleanMacro(Shadow, int);
00301
00305 vtkSetMacro(FontFamily, int);
00306 vtkGetMacro(FontFamily, int);
00307 void SetFontFamilyToArial() {this->SetFontFamily(VTK_ARIAL);};
00308 void SetFontFamilyToCourier() {this->SetFontFamily(VTK_COURIER);};
00309 void SetFontFamilyToTimes() {this->SetFontFamily(VTK_TIMES);};
00310
00312 vtkSetStringMacro(LabelFormat);
00313 vtkGetStringMacro(LabelFormat);
00314
00317 vtkSetClampMacro(Border, int, 0, 50);
00318 vtkGetMacro(Border, int);
00319
00323 vtkGetMacro(PlotPoints, int);
00324 vtkSetMacro(PlotPoints, int);
00325 vtkBooleanMacro(PlotPoints, int);
00326
00329 vtkGetMacro(PlotLines, int);
00330 vtkSetMacro(PlotLines, int);
00331 vtkBooleanMacro(PlotLines, int);
00332
00336 vtkSetClampMacro(GlyphSize, float, 0.0, 0.2);
00337 vtkGetMacro(GlyphSize, float);
00338
00341 void ViewportToPlotCoordinate(vtkViewport *viewport, float &u, float &v);
00342
00346 void ViewportToPlotCoordinate(vtkViewport *viewport);
00347 vtkSetVector2Macro(PlotCoordinate,float);
00348 vtkGetVector2Macro(PlotCoordinate,float);
00349
00351 void PlotToViewportCoordinate(vtkViewport *viewport, float &u, float &v);
00352
00357 void PlotToViewportCoordinate(vtkViewport *viewport);
00358 vtkSetVector2Macro(ViewportCoordinate,float);
00359 vtkGetVector2Macro(ViewportCoordinate,float);
00360
00363 int IsInPlot(vtkViewport *viewport, float u, float v);
00364
00367 unsigned long GetMTime();
00368
00369
00372 int RenderOpaqueGeometry(vtkViewport*);
00373 int RenderOverlay(vtkViewport*);
00374 int RenderTranslucentGeometry(vtkViewport *) {return 0;}
00375
00379 void ReleaseGraphicsResources(vtkWindow *);
00380
00381
00382 protected:
00383 vtkXYPlotActor();
00384 ~vtkXYPlotActor();
00385 vtkXYPlotActor(const vtkXYPlotActor&) {};
00386 void operator=(const vtkXYPlotActor&) {};
00387
00388 vtkDataSetCollection *InputList;
00389 vtkDataObjectCollection *DataObjectInputList;
00390 char *Title;
00391 char *XTitle;
00392 char *YTitle;
00393 int XValues;
00394 int NumberOfXLabels;
00395 int NumberOfYLabels;
00396 int Bold;
00397 int Italic;
00398 int Shadow;
00399 int FontFamily;
00400 char *LabelFormat;
00401 float XRange[2];
00402 float YRange[2];
00403 float XComputedRange[2];
00404 float YComputedRange[2];
00405 int Border;
00406 int PlotLines;
00407 int PlotPoints;
00408
00409 vtkTextMapper *TitleMapper;
00410 vtkActor2D *TitleActor;
00411
00412 vtkAxisActor2D *XAxis;
00413 vtkAxisActor2D *YAxis;
00414
00415 float ViewportCoordinate[2];
00416 float PlotCoordinate[2];
00417
00418
00419 int DataObjectPlotMode;
00420 vtkIntArray *XComponent;
00421 vtkIntArray *YComponent;
00422
00423
00424
00425
00426 int NumberOfInputs;
00427 vtkPolyData **PlotData;
00428 vtkGlyph2D **PlotGlyph;
00429 vtkAppendPolyData **PlotAppend;
00430 vtkPolyDataMapper2D **PlotMapper;
00431 vtkActor2D **PlotActor;
00432 void InitializeEntries();
00433
00434
00435
00436 int Legend;
00437 float LegendPosition[2];
00438 float LegendPosition2[2];
00439 vtkLegendBoxActor *LegendActor;
00440 vtkGlyphSource2D *GlyphSource;
00441 vtkPlanes *ClipPlanes;
00442 float GlyphSize;
00443
00444
00445 int CachedSize[2];
00446 vtkTimeStamp BuildTime;
00447
00448 void ComputeXRange(float range[2], float *lengths);
00449 void ComputeYRange(float range[2]);
00450 void ComputeDORange(float xrange[2], float yrange[2], float *lengths);
00451
00452 virtual void CreatePlotData(int *pos, int *pos2, float xRange[2],
00453 float yRange[2], float *norms,
00454 int numDS, int numDO);
00455 void PlaceAxes(vtkViewport *viewport, int *size, int pos[2], int pos2[2]);
00456 void GenerateClipPlanes(int *pos, int *pos2);
00457 float ComputeGlyphScale(int i, int *pos, int *pos2);
00458 void ClipPlotData(int *pos, int *pos2, vtkPolyData *pd);
00459
00460 };
00461
00462
00463 #endif
00464