00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00084 #ifndef __vtkXYPlotActor_h
00085 #define __vtkXYPlotActor_h
00086
00087 #define VTK_XYPLOT_INDEX 0
00088 #define VTK_XYPLOT_ARC_LENGTH 1
00089 #define VTK_XYPLOT_NORMALIZED_ARC_LENGTH 2
00090 #define VTK_XYPLOT_VALUE 3
00091
00092 #define VTK_XYPLOT_ROW 0
00093 #define VTK_XYPLOT_COLUMN 1
00094
00095 #include "vtkActor2D.h"
00096
00097 class vtkAppendPolyData;
00098 class vtkAxisActor2D;
00099 class vtkDataObject;
00100 class vtkDataObjectCollection;
00101 class vtkDataSet;
00102 class vtkDataSetCollection;
00103 class vtkGlyph2D;
00104 class vtkGlyphSource2D;
00105 class vtkIntArray;
00106 class vtkLegendBoxActor;
00107 class vtkPlanes;
00108 class vtkPolyData;
00109 class vtkPolyDataMapper2D;
00110 class vtkTextMapper;
00111 class vtkTextProperty;
00112
00113 class VTK_HYBRID_EXPORT vtkXYPlotActor : public vtkActor2D
00114 {
00115 public:
00116 vtkTypeRevisionMacro(vtkXYPlotActor,vtkActor2D);
00117 void PrintSelf(ostream& os, vtkIndent indent);
00118
00123 static vtkXYPlotActor *New();
00124
00125
00126
00127
00128
00129
00131
00136 void AddInput(vtkDataSet *in, const char* arrayName, int component);
00137 void AddInput(vtkDataSet *in) {this->AddInput(in, NULL, 0);}
00139
00141
00142 void RemoveInput(vtkDataSet *in, const char* arrayName, int component);
00143 void RemoveInput(vtkDataSet *in) {this->RemoveInput(in, NULL, 0);}
00145
00148 void RemoveAllInputs();
00149
00151 vtkDataSetCollection *GetInputList() {return this->InputList;}
00152
00154
00157 void SetPointComponent(int i, int comp);
00158 int GetPointComponent(int i);
00159
00161
00163
00171 vtkSetClampMacro(XValues,int,VTK_XYPLOT_INDEX,VTK_XYPLOT_VALUE);
00172 vtkGetMacro(XValues,int);
00173 void SetXValuesToIndex(){this->SetXValues(VTK_XYPLOT_INDEX);};
00174 void SetXValuesToArcLength() {this->SetXValues(VTK_XYPLOT_ARC_LENGTH);};
00175 void SetXValuesToNormalizedArcLength()
00176 {this->SetXValues(VTK_XYPLOT_NORMALIZED_ARC_LENGTH);};
00177 void SetXValuesToValue() {this->SetXValues(VTK_XYPLOT_VALUE);};
00178 const char *GetXValuesAsString();
00180
00181
00182
00183
00184
00185
00187 void AddDataObjectInput(vtkDataObject *in);
00188
00190 void RemoveDataObjectInput(vtkDataObject *in);
00191
00193
00194 vtkDataObjectCollection *GetDataObjectInputList()
00195 {return this->DataObjectInputList;}
00197
00199
00201 vtkSetClampMacro(DataObjectPlotMode,int,VTK_XYPLOT_ROW,VTK_XYPLOT_COLUMN);
00202 vtkGetMacro(DataObjectPlotMode,int);
00203 void SetDataObjectPlotModeToRows()
00204 {this->SetDataObjectPlotMode(VTK_XYPLOT_ROW);}
00205 void SetDataObjectPlotModeToColumns()
00206 {this->SetDataObjectPlotMode(VTK_XYPLOT_COLUMN);}
00207 const char *GetDataObjectPlotModeAsString();
00209
00211
00217 void SetDataObjectXComponent(int i, int comp);
00218 int GetDataObjectXComponent(int i);
00220
00222
00228 void SetDataObjectYComponent(int i, int comp);
00229 int GetDataObjectYComponent(int i);
00230
00232
00233
00234
00235
00236
00237
00238 void SetPlotColor(int i, double r, double g, double b);
00239 void SetPlotColor(int i, const double color[3]) {
00240 this->SetPlotColor(i, color[0], color[1], color[2]); };
00241 double *GetPlotColor(int i);
00242 void SetPlotSymbol(int i,vtkPolyData *input);
00243 vtkPolyData *GetPlotSymbol(int i);
00244 void SetPlotLabel(int i, const char *label);
00245 const char *GetPlotLabel(int i);
00246
00247
00248
00249
00250 vtkGetMacro(PlotCurvePoints, int);
00251 vtkSetMacro(PlotCurvePoints, int);
00252 vtkBooleanMacro(PlotCurvePoints, int);
00253
00254 vtkGetMacro(PlotCurveLines, int);
00255 vtkSetMacro(PlotCurveLines, int);
00256 vtkBooleanMacro(PlotCurveLines, int);
00257
00258 void SetPlotLines(int i, int);
00259 int GetPlotLines(int i);
00260
00261 void SetPlotPoints(int i, int);
00262 int GetPlotPoints(int i);
00263
00264
00266
00268 vtkSetMacro(ExchangeAxes, int);
00269 vtkGetMacro(ExchangeAxes, int);
00270 vtkBooleanMacro(ExchangeAxes, int);
00272
00274
00278 vtkSetMacro(ReverseXAxis, int);
00279 vtkGetMacro(ReverseXAxis, int);
00280 vtkBooleanMacro(ReverseXAxis, int);
00282
00284
00288 vtkSetMacro(ReverseYAxis, int);
00289 vtkGetMacro(ReverseYAxis, int);
00290 vtkBooleanMacro(ReverseYAxis, int);
00292
00294
00298 vtkGetObjectMacro(LegendActor,vtkLegendBoxActor);
00299 vtkGetObjectMacro(GlyphSource,vtkGlyphSource2D);
00301
00303
00305 vtkSetStringMacro(Title);
00306 vtkGetStringMacro(Title);
00307 vtkSetStringMacro(XTitle);
00308 vtkGetStringMacro(XTitle);
00309 vtkSetStringMacro(YTitle);
00310 vtkGetStringMacro(YTitle);
00312
00314
00316 vtkAxisActor2D *GetXAxisActor2D()
00317 {return this->XAxis;}
00318 vtkAxisActor2D *GetYAxisActor2D()
00319 {return this->YAxis;}
00321
00323
00329 vtkSetVector2Macro(XRange,double);
00330 vtkGetVectorMacro(XRange,double,2);
00331 vtkSetVector2Macro(YRange,double);
00332 vtkGetVectorMacro(YRange,double,2);
00333 void SetPlotRange(double xmin, double ymin, double xmax, double ymax)
00334 {this->SetXRange(xmin,xmax); this->SetYRange(ymin,ymax);}
00336
00338
00343 vtkSetClampMacro(NumberOfXLabels, int, 0, 50);
00344 vtkGetMacro(NumberOfXLabels, int);
00345 vtkSetClampMacro(NumberOfYLabels, int, 0, 50);
00346 vtkGetMacro(NumberOfYLabels, int);
00347 void SetNumberOfLabels(int num)
00348 {this->SetNumberOfXLabels(num); this->SetNumberOfYLabels(num);}
00350
00352
00357 void SetAdjustXLabels(int adjust);
00358 vtkGetMacro( AdjustXLabels, int );
00359 void SetAdjustYLabels(int adjust);
00360 vtkGetMacro( AdjustYLabels, int );
00362
00364
00365 void SetXTitlePosition(double position);
00366 double GetXTitlePosition();
00367 void SetYTitlePosition(double position);
00368 double GetYTitlePosition();
00370
00372
00373 void SetNumberOfXMinorTicks(int num);
00374 int GetNumberOfXMinorTicks();
00375 void SetNumberOfYMinorTicks(int num);
00376 int GetNumberOfYMinorTicks();
00378
00380
00383 vtkSetMacro(Legend, int);
00384 vtkGetMacro(Legend, int);
00385 vtkBooleanMacro(Legend, int);
00387
00389
00391 vtkSetVector2Macro(TitlePosition,double);
00392 vtkGetVector2Macro(TitlePosition,double);
00394
00396
00398 vtkSetMacro(AdjustTitlePosition, int);
00399 vtkGetMacro(AdjustTitlePosition, int);
00400 vtkBooleanMacro(AdjustTitlePosition, int);
00402
00403
00404 enum Alignment {
00405 AlignLeft = 0x1,
00406 AlignRight = 0x2,
00407 AlignHCenter = 0x4,
00408 AlignTop = 0x10,
00409 AlignBottom = 0x20,
00410 AlignVCenter = 0x40,
00411 AlignAxisLeft = 0x100,
00412 AlignAxisRight = 0x200,
00413 AlignAxisHCenter = 0x400,
00414 AlignAxisTop = 0x1000,
00415 AlignAxisBottom = 0x2000,
00416 AlignAxisVCenter = 0x4000,
00417 };
00418
00420
00425 vtkSetMacro(AdjustTitlePositionMode, int);
00426 vtkGetMacro(AdjustTitlePositionMode, int);
00428
00430
00436 vtkSetVector2Macro(LegendPosition,double);
00437 vtkGetVector2Macro(LegendPosition,double);
00438 vtkSetVector2Macro(LegendPosition2,double);
00439 vtkGetVector2Macro(LegendPosition2,double);
00441
00443
00444 virtual void SetTitleTextProperty(vtkTextProperty *p);
00445 vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
00447
00449
00451 virtual void SetAxisTitleTextProperty(vtkTextProperty *p);
00452 vtkGetObjectMacro(AxisTitleTextProperty,vtkTextProperty);
00454
00456
00458 virtual void SetAxisLabelTextProperty(vtkTextProperty *p);
00459 vtkGetObjectMacro(AxisLabelTextProperty,vtkTextProperty);
00461
00463
00464 vtkSetMacro(Logx, int);
00465 vtkGetMacro(Logx, int);
00466 vtkBooleanMacro(Logx, int);
00468
00470
00472 virtual void SetLabelFormat (const char* _arg);
00473 const char* GetLabelFormat()
00474 {
00475 return this->GetXLabelFormat();
00476 }
00478
00480
00481 virtual void SetXLabelFormat (const char* _arg);
00482 vtkGetStringMacro(XLabelFormat);
00484
00486
00487 virtual void SetYLabelFormat (const char* _arg);
00488 vtkGetStringMacro(YLabelFormat);
00490
00492
00494 vtkSetClampMacro(Border, int, 0, 50);
00495 vtkGetMacro(Border, int);
00497
00499
00502 vtkGetMacro(PlotPoints, int);
00503 vtkSetMacro(PlotPoints, int);
00504 vtkBooleanMacro(PlotPoints, int);
00506
00508
00510 vtkGetMacro(PlotLines, int);
00511 vtkSetMacro(PlotLines, int);
00512 vtkBooleanMacro(PlotLines, int);
00514
00516
00519 vtkSetClampMacro(GlyphSize, double, 0.0, 0.2);
00520 vtkGetMacro(GlyphSize, double);
00522
00525 void ViewportToPlotCoordinate(vtkViewport *viewport, double &u, double &v);
00526
00528
00531 void ViewportToPlotCoordinate(vtkViewport *viewport);
00532 vtkSetVector2Macro(PlotCoordinate,double);
00533 vtkGetVector2Macro(PlotCoordinate,double);
00535
00537 void PlotToViewportCoordinate(vtkViewport *viewport, double &u, double &v);
00538
00540
00544 void PlotToViewportCoordinate(vtkViewport *viewport);
00545 vtkSetVector2Macro(ViewportCoordinate,double);
00546 vtkGetVector2Macro(ViewportCoordinate,double);
00548
00551 int IsInPlot(vtkViewport *viewport, double u, double v);
00552
00554
00556 vtkSetMacro(ChartBox, int);
00557 vtkGetMacro(ChartBox, int);
00558 vtkBooleanMacro(ChartBox, int);
00560
00562
00564 vtkSetMacro(ChartBorder, int);
00565 vtkGetMacro(ChartBorder, int);
00566 vtkBooleanMacro(ChartBorder, int);
00568
00570 vtkProperty2D* GetChartBoxProperty() { return this->ChartBoxActor->GetProperty(); };
00571
00573
00574 vtkSetMacro(ShowReferenceXLine, int);
00575 vtkGetMacro(ShowReferenceXLine, int);
00576 vtkBooleanMacro(ShowReferenceXLine, int);
00578
00580
00581 vtkSetMacro(ReferenceXValue, double);
00582 vtkGetMacro(ReferenceXValue, double);
00584
00586
00587 vtkSetMacro(ShowReferenceYLine, int);
00588 vtkGetMacro(ShowReferenceYLine, int);
00589 vtkBooleanMacro(ShowReferenceYLine, int);
00591
00593
00594 vtkSetMacro(ReferenceYValue, double);
00595 vtkGetMacro(ReferenceYValue, double);
00597
00599 unsigned long GetMTime();
00600
00603 void PrintAsCSV(ostream &os);
00604
00605
00607
00609 int RenderOpaqueGeometry(vtkViewport*);
00610 int RenderOverlay(vtkViewport*);
00611 virtual int RenderTranslucentPolygonalGeometry(vtkViewport *) {return 0;}
00613
00615 virtual int HasTranslucentPolygonalGeometry();
00616
00620 void ReleaseGraphicsResources(vtkWindow *);
00621
00622
00623 protected:
00624 vtkXYPlotActor();
00625 ~vtkXYPlotActor();
00626
00627 vtkDataSetCollection *InputList;
00628 char** SelectedInputScalars;
00629 vtkIntArray* SelectedInputScalarsComponent;
00630 vtkDataObjectCollection *DataObjectInputList;
00631 char *Title;
00632 char *XTitle;
00633 char *YTitle;
00634 int XValues;
00635 int NumberOfXLabels;
00636 int NumberOfYLabels;
00637 int Logx;
00638 char *XLabelFormat;
00639 char *YLabelFormat;
00640 double XRange[2];
00641 double YRange[2];
00642 double XComputedRange[2];
00643 double YComputedRange[2];
00644 int Border;
00645 int PlotLines;
00646 int PlotPoints;
00647 int PlotCurveLines;
00648 int PlotCurvePoints;
00649 int ExchangeAxes;
00650 int ReverseXAxis;
00651 int ReverseYAxis;
00652 int AdjustXLabels;
00653 int AdjustYLabels;
00654 int AdjustTitlePosition;
00655 double TitlePosition[2];
00656 int AdjustTitlePositionMode;
00657
00658 vtkTextMapper *TitleMapper;
00659 vtkActor2D *TitleActor;
00660 vtkTextProperty *TitleTextProperty;
00661
00662 vtkAxisActor2D *XAxis;
00663 vtkAxisActor2D *YAxis;
00664
00665 vtkTextProperty *AxisTitleTextProperty;
00666 vtkTextProperty *AxisLabelTextProperty;
00667
00668 double ViewportCoordinate[2];
00669 double PlotCoordinate[2];
00670
00671
00672 int DataObjectPlotMode;
00673 vtkIntArray *XComponent;
00674 vtkIntArray *YComponent;
00675 vtkIntArray *LinesOn;
00676 vtkIntArray *PointsOn;
00677
00678
00679
00680
00681 int NumberOfInputs;
00682 vtkPolyData **PlotData;
00683 vtkGlyph2D **PlotGlyph;
00684 vtkAppendPolyData **PlotAppend;
00685 vtkPolyDataMapper2D **PlotMapper;
00686 vtkActor2D **PlotActor;
00687 void InitializeEntries();
00688
00689
00690
00691 int Legend;
00692 double LegendPosition[2];
00693 double LegendPosition2[2];
00694 vtkLegendBoxActor *LegendActor;
00695 vtkGlyphSource2D *GlyphSource;
00696 vtkPlanes *ClipPlanes;
00697 double GlyphSize;
00698
00699
00700 int ChartBox;
00701 vtkPolyData *ChartBoxPolyData;
00702 vtkPolyDataMapper2D *ChartBoxMapper;
00703 vtkActor2D *ChartBoxActor;
00704 int ChartBorder;
00705 vtkPolyData *ChartBorderPolyData;
00706 vtkPolyDataMapper2D *ChartBorderMapper;
00707 vtkActor2D *ChartBorderActor;
00708
00709
00710 int ShowReferenceXLine;
00711 int ShowReferenceYLine;
00712 double ReferenceXValue;
00713 double ReferenceYValue;
00714
00715 vtkPolyData *ReferenceLinesPolyData;
00716 vtkPolyDataMapper2D *ReferenceLinesMapper;
00717 vtkActor2D *ReferenceLinesActor;
00718
00719
00720 int CachedSize[2];
00721 vtkTimeStamp BuildTime;
00722
00723 void ComputeXRange(double range[2], double *lengths);
00724 void ComputeYRange(double range[2]);
00725 void ComputeDORange(double xrange[2], double yrange[2], double *lengths);
00726
00727 virtual void CreatePlotData(int *pos, int *pos2, double xRange[2],
00728 double yRange[2], double *norms,
00729 int numDS, int numDO);
00730 void PlaceAxes(vtkViewport *viewport, int *size, int pos[2], int pos2[2]);
00731 void GenerateClipPlanes(int *pos, int *pos2);
00732 double ComputeGlyphScale(int i, int *pos, int *pos2);
00733 void ClipPlotData(int *pos, int *pos2, vtkPolyData *pd);
00734 double *TransformPoint(int pos[2], int pos2[2], double x[3], double xNew[3]);
00735
00736 private:
00737 vtkXYPlotActor(const vtkXYPlotActor&);
00738 void operator=(const vtkXYPlotActor&);
00739 };
00740
00741
00742 #endif