00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00099 #ifndef __vtkXYPlotActor_h
00100 #define __vtkXYPlotActor_h
00101
00102 #define VTK_XYPLOT_INDEX 0
00103 #define VTK_XYPLOT_ARC_LENGTH 1
00104 #define VTK_XYPLOT_NORMALIZED_ARC_LENGTH 2
00105 #define VTK_XYPLOT_VALUE 3
00106
00107 #define VTK_XYPLOT_ROW 0
00108 #define VTK_XYPLOT_COLUMN 1
00109
00110 #include "vtkActor2D.h"
00111
00112 class vtkAppendPolyData;
00113 class vtkAxisActor2D;
00114 class vtkDataObject;
00115 class vtkDataObjectCollection;
00116 class vtkDataSet;
00117 class vtkDataSetCollection;
00118 class vtkGlyph2D;
00119 class vtkGlyphSource2D;
00120 class vtkIntArray;
00121 class vtkLegendBoxActor;
00122 class vtkPlanes;
00123 class vtkPolyData;
00124 class vtkPolyDataMapper2D;
00125 class vtkTextMapper;
00126 class vtkTextProperty;
00127
00128 class VTK_HYBRID_EXPORT vtkXYPlotActor : public vtkActor2D
00129 {
00130 public:
00131 vtkTypeRevisionMacro(vtkXYPlotActor,vtkActor2D);
00132 void PrintSelf(ostream& os, vtkIndent indent);
00133
00138 static vtkXYPlotActor *New();
00139
00140
00141
00142
00143
00144
00146
00150 void AddInput(vtkDataSet *in, const char* arrayName, int component);
00151 void AddInput(vtkDataSet *in) {this->AddInput(in, NULL, 0);}
00153
00155
00156 void RemoveInput(vtkDataSet *in, const char* arrayName, int component);
00157 void RemoveInput(vtkDataSet *in) {this->RemoveInput(in, NULL, 0);}
00159
00162 void RemoveAllInputs();
00163
00165 vtkDataSetCollection *GetInputList() {return this->InputList;}
00166
00168
00171 void SetPointComponent(int i, int comp);
00172 int GetPointComponent(int i);
00173
00175
00177
00185 vtkSetClampMacro(XValues,int,VTK_XYPLOT_INDEX,VTK_XYPLOT_VALUE);
00186 vtkGetMacro(XValues,int);
00187 void SetXValuesToIndex(){this->SetXValues(VTK_XYPLOT_INDEX);};
00188 void SetXValuesToArcLength() {this->SetXValues(VTK_XYPLOT_ARC_LENGTH);};
00189 void SetXValuesToNormalizedArcLength()
00190 {this->SetXValues(VTK_XYPLOT_NORMALIZED_ARC_LENGTH);};
00191 void SetXValuesToValue() {this->SetXValues(VTK_XYPLOT_VALUE);};
00192 const char *GetXValuesAsString();
00194
00195
00196
00197
00198
00199
00201 void AddDataObjectInput(vtkDataObject *in);
00202
00204 void RemoveDataObjectInput(vtkDataObject *in);
00205
00207
00208 vtkDataObjectCollection *GetDataObjectInputList()
00209 {return this->DataObjectInputList;}
00211
00213
00215 vtkSetClampMacro(DataObjectPlotMode,int,VTK_XYPLOT_COLUMN,VTK_XYPLOT_ROW);
00216 vtkGetMacro(DataObjectPlotMode,int);
00217 void SetDataObjectPlotModeToRows()
00218 {this->SetDataObjectPlotMode(VTK_XYPLOT_ROW);}
00219 void SetDataObjectPlotModeToColumns()
00220 {this->SetDataObjectPlotMode(VTK_XYPLOT_COLUMN);}
00221 const char *GetDataObjectPlotModeAsString();
00223
00225
00231 void SetDataObjectXComponent(int i, int comp);
00232 int GetDataObjectXComponent(int i);
00234
00236
00242 void SetDataObjectYComponent(int i, int comp);
00243 int GetDataObjectYComponent(int i);
00244
00246
00247
00248
00249
00250
00251
00252 void SetPlotColor(int i, double r, double g, double b);
00253 void SetPlotColor(int i, const double color[3]) {
00254 this->SetPlotColor(i, color[0], color[1], color[2]); };
00255 double *GetPlotColor(int i);
00256 void SetPlotSymbol(int i,vtkPolyData *input);
00257 vtkPolyData *GetPlotSymbol(int i);
00258 void SetPlotLabel(int i, const char *label);
00259 const char *GetPlotLabel(int i);
00260
00261
00262
00263
00264 vtkGetMacro(PlotCurvePoints, int);
00265 vtkSetMacro(PlotCurvePoints, int);
00266 vtkBooleanMacro(PlotCurvePoints, int);
00267
00268 vtkGetMacro(PlotCurveLines, int);
00269 vtkSetMacro(PlotCurveLines, int);
00270 vtkBooleanMacro(PlotCurveLines, int);
00271
00272 void SetPlotLines(int i, int);
00273 int GetPlotLines(int i);
00274
00275 void SetPlotPoints(int i, int);
00276 int GetPlotPoints(int i);
00277
00278
00280
00282 vtkSetMacro(ExchangeAxes, int);
00283 vtkGetMacro(ExchangeAxes, int);
00284 vtkBooleanMacro(ExchangeAxes, int);
00286
00288
00292 vtkSetMacro(ReverseXAxis, int);
00293 vtkGetMacro(ReverseXAxis, int);
00294 vtkBooleanMacro(ReverseXAxis, int);
00296
00298
00302 vtkSetMacro(ReverseYAxis, int);
00303 vtkGetMacro(ReverseYAxis, int);
00304 vtkBooleanMacro(ReverseYAxis, int);
00306
00308
00312 vtkLegendBoxActor *GetLegendBoxActor()
00313 {return this->LegendActor;}
00314 vtkGlyphSource2D *GetGlyphSource()
00315 {return this->GlyphSource;}
00317
00319
00321 vtkSetStringMacro(Title);
00322 vtkGetStringMacro(Title);
00323 vtkSetStringMacro(XTitle);
00324 vtkGetStringMacro(XTitle);
00325 vtkSetStringMacro(YTitle);
00326 vtkGetStringMacro(YTitle);
00328
00330
00332 vtkAxisActor2D *GetXAxisActor2D()
00333 {return this->XAxis;}
00334 vtkAxisActor2D *GetYAxisActor2D()
00335 {return this->YAxis;}
00337
00339
00345 vtkSetVector2Macro(XRange,double);
00346 vtkGetVectorMacro(XRange,double,2);
00347 vtkSetVector2Macro(YRange,double);
00348 vtkGetVectorMacro(YRange,double,2);
00349 void SetPlotRange(double xmin, double ymin, double xmax, double ymax)
00350 {this->SetXRange(xmin,xmax); this->SetYRange(ymin,ymax);}
00352
00354
00359 vtkSetClampMacro(NumberOfXLabels, int, 0, 50);
00360 vtkGetMacro(NumberOfXLabels, int);
00361 vtkSetClampMacro(NumberOfYLabels, int, 0, 50);
00362 vtkGetMacro(NumberOfYLabels, int);
00363 void SetNumberOfLabels(int num)
00364 {this->SetNumberOfXLabels(num); this->SetNumberOfYLabels(num);}
00366
00368
00371 vtkSetMacro(Legend, int);
00372 vtkGetMacro(Legend, int);
00373 vtkBooleanMacro(Legend, int);
00375
00377
00383 vtkSetVector2Macro(LegendPosition,double);
00384 vtkGetVector2Macro(LegendPosition,double);
00385 vtkSetVector2Macro(LegendPosition2,double);
00386 vtkGetVector2Macro(LegendPosition2,double);
00388
00390
00391 virtual void SetTitleTextProperty(vtkTextProperty *p);
00392 vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
00394
00396
00398 virtual void SetAxisTitleTextProperty(vtkTextProperty *p);
00399 vtkGetObjectMacro(AxisTitleTextProperty,vtkTextProperty);
00401
00403
00405 virtual void SetAxisLabelTextProperty(vtkTextProperty *p);
00406 vtkGetObjectMacro(AxisLabelTextProperty,vtkTextProperty);
00408
00410
00411 vtkSetMacro(Logx, int);
00412 vtkGetMacro(Logx, int);
00413 vtkBooleanMacro(Logx, int);
00415
00417
00418 virtual void SetLabelFormat (const char* _arg);
00419 vtkGetStringMacro(LabelFormat);
00421
00423
00425 vtkSetClampMacro(Border, int, 0, 50);
00426 vtkGetMacro(Border, int);
00428
00430
00433 vtkGetMacro(PlotPoints, int);
00434 vtkSetMacro(PlotPoints, int);
00435 vtkBooleanMacro(PlotPoints, int);
00437
00439
00441 vtkGetMacro(PlotLines, int);
00442 vtkSetMacro(PlotLines, int);
00443 vtkBooleanMacro(PlotLines, int);
00445
00447
00450 vtkSetClampMacro(GlyphSize, double, 0.0, 0.2);
00451 vtkGetMacro(GlyphSize, double);
00453
00456 void ViewportToPlotCoordinate(vtkViewport *viewport, double &u, double &v);
00457
00459
00462 void ViewportToPlotCoordinate(vtkViewport *viewport);
00463 vtkSetVector2Macro(PlotCoordinate,double);
00464 vtkGetVector2Macro(PlotCoordinate,double);
00466
00468 void PlotToViewportCoordinate(vtkViewport *viewport, double &u, double &v);
00469
00471
00475 void PlotToViewportCoordinate(vtkViewport *viewport);
00476 vtkSetVector2Macro(ViewportCoordinate,double);
00477 vtkGetVector2Macro(ViewportCoordinate,double);
00479
00482 int IsInPlot(vtkViewport *viewport, double u, double v);
00483
00485 unsigned long GetMTime();
00486
00487
00489
00491 int RenderOpaqueGeometry(vtkViewport*);
00492 int RenderOverlay(vtkViewport*);
00493 int RenderTranslucentGeometry(vtkViewport *) {return 0;}
00495
00499 void ReleaseGraphicsResources(vtkWindow *);
00500
00501
00502 protected:
00503 vtkXYPlotActor();
00504 ~vtkXYPlotActor();
00505
00506 vtkDataSetCollection *InputList;
00507 char** SelectedInputScalars;
00508 vtkIntArray* SelectedInputScalarsComponent;
00509 vtkDataObjectCollection *DataObjectInputList;
00510 char *Title;
00511 char *XTitle;
00512 char *YTitle;
00513 int XValues;
00514 int NumberOfXLabels;
00515 int NumberOfYLabels;
00516 int Logx;
00517 char *LabelFormat;
00518 double XRange[2];
00519 double YRange[2];
00520 double XComputedRange[2];
00521 double YComputedRange[2];
00522 int Border;
00523 int PlotLines;
00524 int PlotPoints;
00525 int PlotCurveLines;
00526 int PlotCurvePoints;
00527 int ExchangeAxes;
00528 int ReverseXAxis;
00529 int ReverseYAxis;
00530
00531 vtkTextMapper *TitleMapper;
00532 vtkActor2D *TitleActor;
00533 vtkTextProperty *TitleTextProperty;
00534
00535 vtkAxisActor2D *XAxis;
00536 vtkAxisActor2D *YAxis;
00537
00538 vtkTextProperty *AxisTitleTextProperty;
00539 vtkTextProperty *AxisLabelTextProperty;
00540
00541 double ViewportCoordinate[2];
00542 double PlotCoordinate[2];
00543
00544
00545 int DataObjectPlotMode;
00546 vtkIntArray *XComponent;
00547 vtkIntArray *YComponent;
00548 vtkIntArray *LinesOn;
00549 vtkIntArray *PointsOn;
00550
00551
00552
00553
00554 int NumberOfInputs;
00555 vtkPolyData **PlotData;
00556 vtkGlyph2D **PlotGlyph;
00557 vtkAppendPolyData **PlotAppend;
00558 vtkPolyDataMapper2D **PlotMapper;
00559 vtkActor2D **PlotActor;
00560 void InitializeEntries();
00561
00562
00563
00564 int Legend;
00565 double LegendPosition[2];
00566 double LegendPosition2[2];
00567 vtkLegendBoxActor *LegendActor;
00568 vtkGlyphSource2D *GlyphSource;
00569 vtkPlanes *ClipPlanes;
00570 double GlyphSize;
00571
00572
00573 int CachedSize[2];
00574 vtkTimeStamp BuildTime;
00575
00576 void ComputeXRange(double range[2], double *lengths);
00577 void ComputeYRange(double range[2]);
00578 void ComputeDORange(double xrange[2], double yrange[2], double *lengths);
00579
00580 virtual void CreatePlotData(int *pos, int *pos2, double xRange[2],
00581 double yRange[2], double *norms,
00582 int numDS, int numDO);
00583 void PlaceAxes(vtkViewport *viewport, int *size, int pos[2], int pos2[2]);
00584 void GenerateClipPlanes(int *pos, int *pos2);
00585 double ComputeGlyphScale(int i, int *pos, int *pos2);
00586 void ClipPlotData(int *pos, int *pos2, vtkPolyData *pd);
00587 double *TransformPoint(int pos[2], int pos2[2], double x[3], double xNew[3]);
00588
00589 private:
00590 vtkXYPlotActor(const vtkXYPlotActor&);
00591 void operator=(const vtkXYPlotActor&);
00592 };
00593
00594
00595 #endif
00596