00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00087 #ifndef __vtkXYPlotActor_h
00088 #define __vtkXYPlotActor_h
00089
00090 #define VTK_XYPLOT_INDEX 0
00091 #define VTK_XYPLOT_ARC_LENGTH 1
00092 #define VTK_XYPLOT_NORMALIZED_ARC_LENGTH 2
00093 #define VTK_XYPLOT_VALUE 3
00094
00095 #define VTK_XYPLOT_ROW 0
00096 #define VTK_XYPLOT_COLUMN 1
00097
00098 #include "vtkActor2D.h"
00099
00100 class vtkAppendPolyData;
00101 class vtkAxisActor2D;
00102 class vtkDataObject;
00103 class vtkDataObjectCollection;
00104 class vtkDataSet;
00105 class vtkDataSetCollection;
00106 class vtkGlyph2D;
00107 class vtkGlyphSource2D;
00108 class vtkIntArray;
00109 class vtkLegendBoxActor;
00110 class vtkPlanes;
00111 class vtkPolyData;
00112 class vtkPolyDataMapper2D;
00113 class vtkTextMapper;
00114 class vtkTextProperty;
00115
00116 class VTK_HYBRID_EXPORT vtkXYPlotActor : public vtkActor2D
00117 {
00118 public:
00119 vtkTypeRevisionMacro(vtkXYPlotActor,vtkActor2D);
00120 void PrintSelf(ostream& os, vtkIndent indent);
00121
00126 static vtkXYPlotActor *New();
00127
00128
00129
00130
00131
00132
00134
00139 void AddInput(vtkDataSet *in, const char* arrayName, int component);
00140 void AddInput(vtkDataSet *in) {this->AddInput(in, NULL, 0);}
00142
00144
00145 void RemoveInput(vtkDataSet *in, const char* arrayName, int component);
00146 void RemoveInput(vtkDataSet *in) {this->RemoveInput(in, NULL, 0);}
00148
00151 void RemoveAllInputs();
00152
00154 vtkDataSetCollection *GetInputList() {return this->InputList;}
00155
00157
00160 void SetPointComponent(int i, int comp);
00161 int GetPointComponent(int i);
00162
00164
00166
00174 vtkSetClampMacro(XValues,int,VTK_XYPLOT_INDEX,VTK_XYPLOT_VALUE);
00175 vtkGetMacro(XValues,int);
00176 void SetXValuesToIndex(){this->SetXValues(VTK_XYPLOT_INDEX);};
00177 void SetXValuesToArcLength() {this->SetXValues(VTK_XYPLOT_ARC_LENGTH);};
00178 void SetXValuesToNormalizedArcLength()
00179 {this->SetXValues(VTK_XYPLOT_NORMALIZED_ARC_LENGTH);};
00180 void SetXValuesToValue() {this->SetXValues(VTK_XYPLOT_VALUE);};
00181 const char *GetXValuesAsString();
00183
00184
00185
00186
00187
00188
00190 void AddDataObjectInput(vtkDataObject *in);
00191
00193 void RemoveDataObjectInput(vtkDataObject *in);
00194
00196
00197 vtkDataObjectCollection *GetDataObjectInputList()
00198 {return this->DataObjectInputList;}
00200
00202
00204 vtkSetClampMacro(DataObjectPlotMode,int,VTK_XYPLOT_ROW,VTK_XYPLOT_COLUMN);
00205 vtkGetMacro(DataObjectPlotMode,int);
00206 void SetDataObjectPlotModeToRows()
00207 {this->SetDataObjectPlotMode(VTK_XYPLOT_ROW);}
00208 void SetDataObjectPlotModeToColumns()
00209 {this->SetDataObjectPlotMode(VTK_XYPLOT_COLUMN);}
00210 const char *GetDataObjectPlotModeAsString();
00212
00214
00220 void SetDataObjectXComponent(int i, int comp);
00221 int GetDataObjectXComponent(int i);
00223
00225
00231 void SetDataObjectYComponent(int i, int comp);
00232 int GetDataObjectYComponent(int i);
00233
00235
00236
00237
00238
00239
00240
00241 void SetPlotColor(int i, double r, double g, double b);
00242 void SetPlotColor(int i, const double color[3]) {
00243 this->SetPlotColor(i, color[0], color[1], color[2]); };
00244 double *GetPlotColor(int i);
00245 void SetPlotSymbol(int i,vtkPolyData *input);
00246 vtkPolyData *GetPlotSymbol(int i);
00247 void SetPlotLabel(int i, const char *label);
00248 const char *GetPlotLabel(int i);
00249
00250
00251
00252
00253 vtkGetMacro(PlotCurvePoints, int);
00254 vtkSetMacro(PlotCurvePoints, int);
00255 vtkBooleanMacro(PlotCurvePoints, int);
00256
00257 vtkGetMacro(PlotCurveLines, int);
00258 vtkSetMacro(PlotCurveLines, int);
00259 vtkBooleanMacro(PlotCurveLines, int);
00260
00261 void SetPlotLines(int i, int);
00262 int GetPlotLines(int i);
00263
00264 void SetPlotPoints(int i, int);
00265 int GetPlotPoints(int i);
00266
00267
00269
00271 vtkSetMacro(ExchangeAxes, int);
00272 vtkGetMacro(ExchangeAxes, int);
00273 vtkBooleanMacro(ExchangeAxes, int);
00275
00277
00281 vtkSetMacro(ReverseXAxis, int);
00282 vtkGetMacro(ReverseXAxis, int);
00283 vtkBooleanMacro(ReverseXAxis, int);
00285
00287
00291 vtkSetMacro(ReverseYAxis, int);
00292 vtkGetMacro(ReverseYAxis, int);
00293 vtkBooleanMacro(ReverseYAxis, int);
00295
00297
00301 vtkGetObjectMacro(LegendActor,vtkLegendBoxActor);
00302 vtkGetObjectMacro(GlyphSource,vtkGlyphSource2D);
00304
00306
00308 vtkSetStringMacro(Title);
00309 vtkGetStringMacro(Title);
00310 vtkSetStringMacro(XTitle);
00311 vtkGetStringMacro(XTitle);
00312 vtkSetStringMacro(YTitle);
00313 vtkGetStringMacro(YTitle);
00315
00317
00319 vtkAxisActor2D *GetXAxisActor2D()
00320 {return this->XAxis;}
00321 vtkAxisActor2D *GetYAxisActor2D()
00322 {return this->YAxis;}
00324
00326
00332 vtkSetVector2Macro(XRange,double);
00333 vtkGetVectorMacro(XRange,double,2);
00334 vtkSetVector2Macro(YRange,double);
00335 vtkGetVectorMacro(YRange,double,2);
00336 void SetPlotRange(double xmin, double ymin, double xmax, double ymax)
00337 {this->SetXRange(xmin,xmax); this->SetYRange(ymin,ymax);}
00339
00341
00346 vtkSetClampMacro(NumberOfXLabels, int, 0, 50);
00347 vtkGetMacro(NumberOfXLabels, int);
00348 vtkSetClampMacro(NumberOfYLabels, int, 0, 50);
00349 vtkGetMacro(NumberOfYLabels, int);
00350 void SetNumberOfLabels(int num)
00351 {this->SetNumberOfXLabels(num); this->SetNumberOfYLabels(num);}
00353
00355
00360 void SetAdjustXLabels(int adjust);
00361 int GetAdjustXLabels();
00362 void SetAdjustYLabels(int adjust);
00363 int GetAdjustYLabels();
00365
00367
00368 void SetXTitlePosition(double position);
00369 double GetXTitlePosition();
00370 void SetYTitlePosition(double position);
00371 double GetYTitlePosition();
00373
00375
00376 void SetNumberOfXMinorTicks(int num);
00377 int GetNumberOfXMinorTicks();
00378 void SetNumberOfYMinorTicks(int num);
00379 int GetNumberOfYMinorTicks();
00381
00383
00386 vtkSetMacro(Legend, int);
00387 vtkGetMacro(Legend, int);
00388 vtkBooleanMacro(Legend, int);
00390
00392
00394 vtkSetVector2Macro(TitlePosition,double);
00395 vtkGetVector2Macro(TitlePosition,double);
00397
00399
00401 vtkSetMacro(AdjustTitlePosition, int);
00402 vtkGetMacro(AdjustTitlePosition, int);
00403 vtkBooleanMacro(AdjustTitlePosition, int);
00405
00407
00413 vtkSetVector2Macro(LegendPosition,double);
00414 vtkGetVector2Macro(LegendPosition,double);
00415 vtkSetVector2Macro(LegendPosition2,double);
00416 vtkGetVector2Macro(LegendPosition2,double);
00418
00420
00421 virtual void SetTitleTextProperty(vtkTextProperty *p);
00422 vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
00424
00426
00428 virtual void SetAxisTitleTextProperty(vtkTextProperty *p);
00429 vtkGetObjectMacro(AxisTitleTextProperty,vtkTextProperty);
00431
00433
00435 virtual void SetAxisLabelTextProperty(vtkTextProperty *p);
00436 vtkGetObjectMacro(AxisLabelTextProperty,vtkTextProperty);
00438
00440
00441 vtkSetMacro(Logx, int);
00442 vtkGetMacro(Logx, int);
00443 vtkBooleanMacro(Logx, int);
00445
00447
00449 virtual void SetLabelFormat (const char* _arg);
00450 const char* GetLabelFormat()
00451 {
00452 return this->GetXLabelFormat();
00453 }
00455
00457
00458 virtual void SetXLabelFormat (const char* _arg);
00459 vtkGetStringMacro(XLabelFormat);
00461
00463
00464 virtual void SetYLabelFormat (const char* _arg);
00465 vtkGetStringMacro(YLabelFormat);
00467
00469
00471 vtkSetClampMacro(Border, int, 0, 50);
00472 vtkGetMacro(Border, int);
00474
00476
00479 vtkGetMacro(PlotPoints, int);
00480 vtkSetMacro(PlotPoints, int);
00481 vtkBooleanMacro(PlotPoints, int);
00483
00485
00487 vtkGetMacro(PlotLines, int);
00488 vtkSetMacro(PlotLines, int);
00489 vtkBooleanMacro(PlotLines, int);
00491
00493
00496 vtkSetClampMacro(GlyphSize, double, 0.0, 0.2);
00497 vtkGetMacro(GlyphSize, double);
00499
00502 void ViewportToPlotCoordinate(vtkViewport *viewport, double &u, double &v);
00503
00505
00508 void ViewportToPlotCoordinate(vtkViewport *viewport);
00509 vtkSetVector2Macro(PlotCoordinate,double);
00510 vtkGetVector2Macro(PlotCoordinate,double);
00512
00514 void PlotToViewportCoordinate(vtkViewport *viewport, double &u, double &v);
00515
00517
00521 void PlotToViewportCoordinate(vtkViewport *viewport);
00522 vtkSetVector2Macro(ViewportCoordinate,double);
00523 vtkGetVector2Macro(ViewportCoordinate,double);
00525
00528 int IsInPlot(vtkViewport *viewport, double u, double v);
00529
00531 unsigned long GetMTime();
00532
00535 void PrintAsCSV(ostream &os);
00536
00537
00539
00541 int RenderOpaqueGeometry(vtkViewport*);
00542 int RenderOverlay(vtkViewport*);
00543 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *) {return 0;}
00545
00547 virtual int HasTranslucentPolygonalGeometry();
00548
00552 void ReleaseGraphicsResources(vtkWindow *);
00553
00554
00555 protected:
00556 vtkXYPlotActor();
00557 ~vtkXYPlotActor();
00558
00559 vtkDataSetCollection *InputList;
00560 char** SelectedInputScalars;
00561 vtkIntArray* SelectedInputScalarsComponent;
00562 vtkDataObjectCollection *DataObjectInputList;
00563 char *Title;
00564 char *XTitle;
00565 char *YTitle;
00566 int XValues;
00567 int NumberOfXLabels;
00568 int NumberOfYLabels;
00569 int Logx;
00570 char *XLabelFormat;
00571 char *YLabelFormat;
00572 double XRange[2];
00573 double YRange[2];
00574 double XComputedRange[2];
00575 double YComputedRange[2];
00576 int Border;
00577 int PlotLines;
00578 int PlotPoints;
00579 int PlotCurveLines;
00580 int PlotCurvePoints;
00581 int ExchangeAxes;
00582 int ReverseXAxis;
00583 int ReverseYAxis;
00584 int AdjustTitlePosition;
00585 double TitlePosition[2];
00586
00587 vtkTextMapper *TitleMapper;
00588 vtkActor2D *TitleActor;
00589 vtkTextProperty *TitleTextProperty;
00590
00591 vtkAxisActor2D *XAxis;
00592 vtkAxisActor2D *YAxis;
00593
00594 vtkTextProperty *AxisTitleTextProperty;
00595 vtkTextProperty *AxisLabelTextProperty;
00596
00597 double ViewportCoordinate[2];
00598 double PlotCoordinate[2];
00599
00600
00601 int DataObjectPlotMode;
00602 vtkIntArray *XComponent;
00603 vtkIntArray *YComponent;
00604 vtkIntArray *LinesOn;
00605 vtkIntArray *PointsOn;
00606
00607
00608
00609
00610 int NumberOfInputs;
00611 vtkPolyData **PlotData;
00612 vtkGlyph2D **PlotGlyph;
00613 vtkAppendPolyData **PlotAppend;
00614 vtkPolyDataMapper2D **PlotMapper;
00615 vtkActor2D **PlotActor;
00616 void InitializeEntries();
00617
00618
00619
00620 int Legend;
00621 double LegendPosition[2];
00622 double LegendPosition2[2];
00623 vtkLegendBoxActor *LegendActor;
00624 vtkGlyphSource2D *GlyphSource;
00625 vtkPlanes *ClipPlanes;
00626 double GlyphSize;
00627
00628
00629 int CachedSize[2];
00630 vtkTimeStamp BuildTime;
00631
00632 void ComputeXRange(double range[2], double *lengths);
00633 void ComputeYRange(double range[2]);
00634 void ComputeDORange(double xrange[2], double yrange[2], double *lengths);
00635
00636 virtual void CreatePlotData(int *pos, int *pos2, double xRange[2],
00637 double yRange[2], double *norms,
00638 int numDS, int numDO);
00639 void PlaceAxes(vtkViewport *viewport, int *size, int pos[2], int pos2[2]);
00640 void GenerateClipPlanes(int *pos, int *pos2);
00641 double ComputeGlyphScale(int i, int *pos, int *pos2);
00642 void ClipPlotData(int *pos, int *pos2, vtkPolyData *pd);
00643 double *TransformPoint(int pos[2], int pos2[2], double x[3], double xNew[3]);
00644
00645 private:
00646 vtkXYPlotActor(const vtkXYPlotActor&);
00647 void operator=(const vtkXYPlotActor&);
00648 };
00649
00650
00651 #endif
00652