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
00138 void AddInput(vtkDataSet *in, const char* arrayName, int component);
00139 void AddInput(vtkDataSet *in) {this->AddInput(in, NULL, 0);}
00141
00143
00144 void RemoveInput(vtkDataSet *in, const char* arrayName, int component);
00145 void RemoveInput(vtkDataSet *in) {this->RemoveInput(in, NULL, 0);}
00147
00150 void RemoveAllInputs();
00151
00153 vtkDataSetCollection *GetInputList() {return this->InputList;}
00154
00156
00159 void SetPointComponent(int i, int comp);
00160 int GetPointComponent(int i);
00161
00163
00165
00173 vtkSetClampMacro(XValues,int,VTK_XYPLOT_INDEX,VTK_XYPLOT_VALUE);
00174 vtkGetMacro(XValues,int);
00175 void SetXValuesToIndex(){this->SetXValues(VTK_XYPLOT_INDEX);};
00176 void SetXValuesToArcLength() {this->SetXValues(VTK_XYPLOT_ARC_LENGTH);};
00177 void SetXValuesToNormalizedArcLength()
00178 {this->SetXValues(VTK_XYPLOT_NORMALIZED_ARC_LENGTH);};
00179 void SetXValuesToValue() {this->SetXValues(VTK_XYPLOT_VALUE);};
00180 const char *GetXValuesAsString();
00182
00183
00184
00185
00186
00187
00189 void AddDataObjectInput(vtkDataObject *in);
00190
00192 void RemoveDataObjectInput(vtkDataObject *in);
00193
00195
00196 vtkDataObjectCollection *GetDataObjectInputList()
00197 {return this->DataObjectInputList;}
00199
00201
00203 vtkSetClampMacro(DataObjectPlotMode,int,VTK_XYPLOT_ROW,VTK_XYPLOT_COLUMN);
00204 vtkGetMacro(DataObjectPlotMode,int);
00205 void SetDataObjectPlotModeToRows()
00206 {this->SetDataObjectPlotMode(VTK_XYPLOT_ROW);}
00207 void SetDataObjectPlotModeToColumns()
00208 {this->SetDataObjectPlotMode(VTK_XYPLOT_COLUMN);}
00209 const char *GetDataObjectPlotModeAsString();
00211
00213
00219 void SetDataObjectXComponent(int i, int comp);
00220 int GetDataObjectXComponent(int i);
00222
00224
00230 void SetDataObjectYComponent(int i, int comp);
00231 int GetDataObjectYComponent(int i);
00232
00234
00235
00236
00237
00238
00239
00240 void SetPlotColor(int i, double r, double g, double b);
00241 void SetPlotColor(int i, const double color[3]) {
00242 this->SetPlotColor(i, color[0], color[1], color[2]); };
00243 double *GetPlotColor(int i);
00244 void SetPlotSymbol(int i,vtkPolyData *input);
00245 vtkPolyData *GetPlotSymbol(int i);
00246 void SetPlotLabel(int i, const char *label);
00247 const char *GetPlotLabel(int i);
00248
00249
00250
00251
00252 vtkGetMacro(PlotCurvePoints, int);
00253 vtkSetMacro(PlotCurvePoints, int);
00254 vtkBooleanMacro(PlotCurvePoints, int);
00255
00256 vtkGetMacro(PlotCurveLines, int);
00257 vtkSetMacro(PlotCurveLines, int);
00258 vtkBooleanMacro(PlotCurveLines, int);
00259
00260 void SetPlotLines(int i, int);
00261 int GetPlotLines(int i);
00262
00263 void SetPlotPoints(int i, int);
00264 int GetPlotPoints(int i);
00265
00266
00268
00270 vtkSetMacro(ExchangeAxes, int);
00271 vtkGetMacro(ExchangeAxes, int);
00272 vtkBooleanMacro(ExchangeAxes, int);
00274
00276
00280 vtkSetMacro(ReverseXAxis, int);
00281 vtkGetMacro(ReverseXAxis, int);
00282 vtkBooleanMacro(ReverseXAxis, int);
00284
00286
00290 vtkSetMacro(ReverseYAxis, int);
00291 vtkGetMacro(ReverseYAxis, int);
00292 vtkBooleanMacro(ReverseYAxis, int);
00294
00296
00300 vtkGetObjectMacro(LegendActor,vtkLegendBoxActor);
00301 vtkGetObjectMacro(GlyphSource,vtkGlyphSource2D);
00303
00305
00307 vtkSetStringMacro(Title);
00308 vtkGetStringMacro(Title);
00309 vtkSetStringMacro(XTitle);
00310 vtkGetStringMacro(XTitle);
00311 vtkSetStringMacro(YTitle);
00312 vtkGetStringMacro(YTitle);
00314
00316
00318 vtkAxisActor2D *GetXAxisActor2D()
00319 {return this->XAxis;}
00320 vtkAxisActor2D *GetYAxisActor2D()
00321 {return this->YAxis;}
00323
00325
00331 vtkSetVector2Macro(XRange,double);
00332 vtkGetVectorMacro(XRange,double,2);
00333 vtkSetVector2Macro(YRange,double);
00334 vtkGetVectorMacro(YRange,double,2);
00335 void SetPlotRange(double xmin, double ymin, double xmax, double ymax)
00336 {this->SetXRange(xmin,xmax); this->SetYRange(ymin,ymax);}
00338
00340
00345 vtkSetClampMacro(NumberOfXLabels, int, 0, 50);
00346 vtkGetMacro(NumberOfXLabels, int);
00347 vtkSetClampMacro(NumberOfYLabels, int, 0, 50);
00348 vtkGetMacro(NumberOfYLabels, int);
00349 void SetNumberOfLabels(int num)
00350 {this->SetNumberOfXLabels(num); this->SetNumberOfYLabels(num);}
00352
00354
00357 vtkSetMacro(Legend, int);
00358 vtkGetMacro(Legend, int);
00359 vtkBooleanMacro(Legend, int);
00361
00363
00369 vtkSetVector2Macro(LegendPosition,double);
00370 vtkGetVector2Macro(LegendPosition,double);
00371 vtkSetVector2Macro(LegendPosition2,double);
00372 vtkGetVector2Macro(LegendPosition2,double);
00374
00376
00377 virtual void SetTitleTextProperty(vtkTextProperty *p);
00378 vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
00380
00382
00384 virtual void SetAxisTitleTextProperty(vtkTextProperty *p);
00385 vtkGetObjectMacro(AxisTitleTextProperty,vtkTextProperty);
00387
00389
00391 virtual void SetAxisLabelTextProperty(vtkTextProperty *p);
00392 vtkGetObjectMacro(AxisLabelTextProperty,vtkTextProperty);
00394
00396
00397 vtkSetMacro(Logx, int);
00398 vtkGetMacro(Logx, int);
00399 vtkBooleanMacro(Logx, int);
00401
00403
00404 virtual void SetLabelFormat (const char* _arg);
00405 vtkGetStringMacro(LabelFormat);
00407
00409
00411 vtkSetClampMacro(Border, int, 0, 50);
00412 vtkGetMacro(Border, int);
00414
00416
00419 vtkGetMacro(PlotPoints, int);
00420 vtkSetMacro(PlotPoints, int);
00421 vtkBooleanMacro(PlotPoints, int);
00423
00425
00427 vtkGetMacro(PlotLines, int);
00428 vtkSetMacro(PlotLines, int);
00429 vtkBooleanMacro(PlotLines, int);
00431
00433
00436 vtkSetClampMacro(GlyphSize, double, 0.0, 0.2);
00437 vtkGetMacro(GlyphSize, double);
00439
00442 void ViewportToPlotCoordinate(vtkViewport *viewport, double &u, double &v);
00443
00445
00448 void ViewportToPlotCoordinate(vtkViewport *viewport);
00449 vtkSetVector2Macro(PlotCoordinate,double);
00450 vtkGetVector2Macro(PlotCoordinate,double);
00452
00454 void PlotToViewportCoordinate(vtkViewport *viewport, double &u, double &v);
00455
00457
00461 void PlotToViewportCoordinate(vtkViewport *viewport);
00462 vtkSetVector2Macro(ViewportCoordinate,double);
00463 vtkGetVector2Macro(ViewportCoordinate,double);
00465
00468 int IsInPlot(vtkViewport *viewport, double u, double v);
00469
00471 unsigned long GetMTime();
00472
00475 void PrintAsCSV(ostream &os);
00476
00477
00479
00481 int RenderOpaqueGeometry(vtkViewport*);
00482 int RenderOverlay(vtkViewport*);
00483 int RenderTranslucentGeometry(vtkViewport *) {return 0;}
00485
00489 void ReleaseGraphicsResources(vtkWindow *);
00490
00491
00492 protected:
00493 vtkXYPlotActor();
00494 ~vtkXYPlotActor();
00495
00496 vtkDataSetCollection *InputList;
00497 char** SelectedInputScalars;
00498 vtkIntArray* SelectedInputScalarsComponent;
00499 vtkDataObjectCollection *DataObjectInputList;
00500 char *Title;
00501 char *XTitle;
00502 char *YTitle;
00503 int XValues;
00504 int NumberOfXLabels;
00505 int NumberOfYLabels;
00506 int Logx;
00507 char *LabelFormat;
00508 double XRange[2];
00509 double YRange[2];
00510 double XComputedRange[2];
00511 double YComputedRange[2];
00512 int Border;
00513 int PlotLines;
00514 int PlotPoints;
00515 int PlotCurveLines;
00516 int PlotCurvePoints;
00517 int ExchangeAxes;
00518 int ReverseXAxis;
00519 int ReverseYAxis;
00520
00521 vtkTextMapper *TitleMapper;
00522 vtkActor2D *TitleActor;
00523 vtkTextProperty *TitleTextProperty;
00524
00525 vtkAxisActor2D *XAxis;
00526 vtkAxisActor2D *YAxis;
00527
00528 vtkTextProperty *AxisTitleTextProperty;
00529 vtkTextProperty *AxisLabelTextProperty;
00530
00531 double ViewportCoordinate[2];
00532 double PlotCoordinate[2];
00533
00534
00535 int DataObjectPlotMode;
00536 vtkIntArray *XComponent;
00537 vtkIntArray *YComponent;
00538 vtkIntArray *LinesOn;
00539 vtkIntArray *PointsOn;
00540
00541
00542
00543
00544 int NumberOfInputs;
00545 vtkPolyData **PlotData;
00546 vtkGlyph2D **PlotGlyph;
00547 vtkAppendPolyData **PlotAppend;
00548 vtkPolyDataMapper2D **PlotMapper;
00549 vtkActor2D **PlotActor;
00550 void InitializeEntries();
00551
00552
00553
00554 int Legend;
00555 double LegendPosition[2];
00556 double LegendPosition2[2];
00557 vtkLegendBoxActor *LegendActor;
00558 vtkGlyphSource2D *GlyphSource;
00559 vtkPlanes *ClipPlanes;
00560 double GlyphSize;
00561
00562
00563 int CachedSize[2];
00564 vtkTimeStamp BuildTime;
00565
00566 void ComputeXRange(double range[2], double *lengths);
00567 void ComputeYRange(double range[2]);
00568 void ComputeDORange(double xrange[2], double yrange[2], double *lengths);
00569
00570 virtual void CreatePlotData(int *pos, int *pos2, double xRange[2],
00571 double yRange[2], double *norms,
00572 int numDS, int numDO);
00573 void PlaceAxes(vtkViewport *viewport, int *size, int pos[2], int pos2[2]);
00574 void GenerateClipPlanes(int *pos, int *pos2);
00575 double ComputeGlyphScale(int i, int *pos, int *pos2);
00576 void ClipPlotData(int *pos, int *pos2, vtkPolyData *pd);
00577 double *TransformPoint(int pos[2], int pos2[2], double x[3], double xNew[3]);
00578
00579 private:
00580 vtkXYPlotActor(const vtkXYPlotActor&);
00581 void operator=(const vtkXYPlotActor&);
00582 };
00583
00584
00585 #endif
00586