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_COLUMN,VTK_XYPLOT_ROW);
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 vtkLegendBoxActor *GetLegendBoxActor()
00301 {return this->LegendActor;}
00302 vtkGlyphSource2D *GetGlyphSource()
00303 {return this->GlyphSource;}
00305
00307
00309 vtkSetStringMacro(Title);
00310 vtkGetStringMacro(Title);
00311 vtkSetStringMacro(XTitle);
00312 vtkGetStringMacro(XTitle);
00313 vtkSetStringMacro(YTitle);
00314 vtkGetStringMacro(YTitle);
00316
00318
00320 vtkAxisActor2D *GetXAxisActor2D()
00321 {return this->XAxis;}
00322 vtkAxisActor2D *GetYAxisActor2D()
00323 {return this->YAxis;}
00325
00327
00333 vtkSetVector2Macro(XRange,double);
00334 vtkGetVectorMacro(XRange,double,2);
00335 vtkSetVector2Macro(YRange,double);
00336 vtkGetVectorMacro(YRange,double,2);
00337 void SetPlotRange(double xmin, double ymin, double xmax, double ymax)
00338 {this->SetXRange(xmin,xmax); this->SetYRange(ymin,ymax);}
00340
00342
00347 vtkSetClampMacro(NumberOfXLabels, int, 0, 50);
00348 vtkGetMacro(NumberOfXLabels, int);
00349 vtkSetClampMacro(NumberOfYLabels, int, 0, 50);
00350 vtkGetMacro(NumberOfYLabels, int);
00351 void SetNumberOfLabels(int num)
00352 {this->SetNumberOfXLabels(num); this->SetNumberOfYLabels(num);}
00354
00356
00359 vtkSetMacro(Legend, int);
00360 vtkGetMacro(Legend, int);
00361 vtkBooleanMacro(Legend, int);
00363
00365
00371 vtkSetVector2Macro(LegendPosition,double);
00372 vtkGetVector2Macro(LegendPosition,double);
00373 vtkSetVector2Macro(LegendPosition2,double);
00374 vtkGetVector2Macro(LegendPosition2,double);
00376
00378
00379 virtual void SetTitleTextProperty(vtkTextProperty *p);
00380 vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
00382
00384
00386 virtual void SetAxisTitleTextProperty(vtkTextProperty *p);
00387 vtkGetObjectMacro(AxisTitleTextProperty,vtkTextProperty);
00389
00391
00393 virtual void SetAxisLabelTextProperty(vtkTextProperty *p);
00394 vtkGetObjectMacro(AxisLabelTextProperty,vtkTextProperty);
00396
00398
00399 vtkSetMacro(Logx, int);
00400 vtkGetMacro(Logx, int);
00401 vtkBooleanMacro(Logx, int);
00403
00405
00406 virtual void SetLabelFormat (const char* _arg);
00407 vtkGetStringMacro(LabelFormat);
00409
00411
00413 vtkSetClampMacro(Border, int, 0, 50);
00414 vtkGetMacro(Border, int);
00416
00418
00421 vtkGetMacro(PlotPoints, int);
00422 vtkSetMacro(PlotPoints, int);
00423 vtkBooleanMacro(PlotPoints, int);
00425
00427
00429 vtkGetMacro(PlotLines, int);
00430 vtkSetMacro(PlotLines, int);
00431 vtkBooleanMacro(PlotLines, int);
00433
00435
00438 vtkSetClampMacro(GlyphSize, double, 0.0, 0.2);
00439 vtkGetMacro(GlyphSize, double);
00441
00444 void ViewportToPlotCoordinate(vtkViewport *viewport, double &u, double &v);
00445
00447
00450 void ViewportToPlotCoordinate(vtkViewport *viewport);
00451 vtkSetVector2Macro(PlotCoordinate,double);
00452 vtkGetVector2Macro(PlotCoordinate,double);
00454
00456 void PlotToViewportCoordinate(vtkViewport *viewport, double &u, double &v);
00457
00459
00463 void PlotToViewportCoordinate(vtkViewport *viewport);
00464 vtkSetVector2Macro(ViewportCoordinate,double);
00465 vtkGetVector2Macro(ViewportCoordinate,double);
00467
00470 int IsInPlot(vtkViewport *viewport, double u, double v);
00471
00473 unsigned long GetMTime();
00474
00475
00477
00479 int RenderOpaqueGeometry(vtkViewport*);
00480 int RenderOverlay(vtkViewport*);
00481 int RenderTranslucentGeometry(vtkViewport *) {return 0;}
00483
00487 void ReleaseGraphicsResources(vtkWindow *);
00488
00489
00490 protected:
00491 vtkXYPlotActor();
00492 ~vtkXYPlotActor();
00493
00494 vtkDataSetCollection *InputList;
00495 char** SelectedInputScalars;
00496 vtkIntArray* SelectedInputScalarsComponent;
00497 vtkDataObjectCollection *DataObjectInputList;
00498 char *Title;
00499 char *XTitle;
00500 char *YTitle;
00501 int XValues;
00502 int NumberOfXLabels;
00503 int NumberOfYLabels;
00504 int Logx;
00505 char *LabelFormat;
00506 double XRange[2];
00507 double YRange[2];
00508 double XComputedRange[2];
00509 double YComputedRange[2];
00510 int Border;
00511 int PlotLines;
00512 int PlotPoints;
00513 int PlotCurveLines;
00514 int PlotCurvePoints;
00515 int ExchangeAxes;
00516 int ReverseXAxis;
00517 int ReverseYAxis;
00518
00519 vtkTextMapper *TitleMapper;
00520 vtkActor2D *TitleActor;
00521 vtkTextProperty *TitleTextProperty;
00522
00523 vtkAxisActor2D *XAxis;
00524 vtkAxisActor2D *YAxis;
00525
00526 vtkTextProperty *AxisTitleTextProperty;
00527 vtkTextProperty *AxisLabelTextProperty;
00528
00529 double ViewportCoordinate[2];
00530 double PlotCoordinate[2];
00531
00532
00533 int DataObjectPlotMode;
00534 vtkIntArray *XComponent;
00535 vtkIntArray *YComponent;
00536 vtkIntArray *LinesOn;
00537 vtkIntArray *PointsOn;
00538
00539
00540
00541
00542 int NumberOfInputs;
00543 vtkPolyData **PlotData;
00544 vtkGlyph2D **PlotGlyph;
00545 vtkAppendPolyData **PlotAppend;
00546 vtkPolyDataMapper2D **PlotMapper;
00547 vtkActor2D **PlotActor;
00548 void InitializeEntries();
00549
00550
00551
00552 int Legend;
00553 double LegendPosition[2];
00554 double LegendPosition2[2];
00555 vtkLegendBoxActor *LegendActor;
00556 vtkGlyphSource2D *GlyphSource;
00557 vtkPlanes *ClipPlanes;
00558 double GlyphSize;
00559
00560
00561 int CachedSize[2];
00562 vtkTimeStamp BuildTime;
00563
00564 void ComputeXRange(double range[2], double *lengths);
00565 void ComputeYRange(double range[2]);
00566 void ComputeDORange(double xrange[2], double yrange[2], double *lengths);
00567
00568 virtual void CreatePlotData(int *pos, int *pos2, double xRange[2],
00569 double yRange[2], double *norms,
00570 int numDS, int numDO);
00571 void PlaceAxes(vtkViewport *viewport, int *size, int pos[2], int pos2[2]);
00572 void GenerateClipPlanes(int *pos, int *pos2);
00573 double ComputeGlyphScale(int i, int *pos, int *pos2);
00574 void ClipPlotData(int *pos, int *pos2, vtkPolyData *pd);
00575 double *TransformPoint(int pos[2], int pos2[2], double x[3], double xNew[3]);
00576
00577 private:
00578 vtkXYPlotActor(const vtkXYPlotActor&);
00579 void operator=(const vtkXYPlotActor&);
00580 };
00581
00582
00583 #endif
00584