00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00107 #ifndef __vtkXYPlotActor_h
00108 #define __vtkXYPlotActor_h
00109
00110 #define VTK_XYPLOT_INDEX 0
00111 #define VTK_XYPLOT_ARC_LENGTH 1
00112 #define VTK_XYPLOT_NORMALIZED_ARC_LENGTH 2
00113 #define VTK_XYPLOT_VALUE 3
00114
00115 #define VTK_XYPLOT_ROW 0
00116 #define VTK_XYPLOT_COLUMN 1
00117
00118 #include "vtkAxisActor2D.h"
00119 class vtkDataSetCollection;
00120 class vtkDataObjectCollection;
00121 class vtkGlyphSource2D;
00122 class vtkGlyph2D;
00123 class vtkLegendBoxActor;
00124 class vtkAppendPolyData;
00125 class vtkPlanes;
00126 class vtkIntArray;
00127
00128 class VTK_HYBRID_EXPORT vtkXYPlotActor : public vtkActor2D
00129 {
00130 public:
00131 vtkTypeMacro(vtkXYPlotActor,vtkActor2D);
00132 void PrintSelf(ostream& os, vtkIndent indent);
00133
00138 static vtkXYPlotActor *New();
00139
00140
00141
00142
00143
00144
00146 void AddInput(vtkDataSet *in);
00147
00149 void RemoveInput(vtkDataSet *in);
00150
00152 vtkDataSetCollection *GetInputList() {return this->InputList;}
00153
00155
00158 void SetPointComponent(int i, int comp);
00159 int GetPointComponent(int i);
00160
00162
00164
00165 The independent variable can be the scalar/point index (i.e., point
00166 id), the accumulated arc length along the points, the normalized arc
00167 length, or by component value. If plotting datasets (e.g., points),
00168 the value that is used is specified by the PointComponent ivar.
00169 (Note: these methods also control how field data is plotted. Field
00170 data is usually plotted by value or index, if plotting length
00171 1-dimensional length measures are used.) */
00172 vtkSetClampMacro(XValues,int,VTK_XYPLOT_INDEX,VTK_XYPLOT_VALUE);
00173 vtkGetMacro(XValues,int);
00174 void SetXValuesToIndex(){this->SetXValues(VTK_XYPLOT_INDEX);};
00175 void SetXValuesToArcLength() {this->SetXValues(VTK_XYPLOT_ARC_LENGTH);};
00176 void SetXValuesToNormalizedArcLength()
00177 {this->SetXValues(VTK_XYPLOT_NORMALIZED_ARC_LENGTH);};
00178 void SetXValuesToValue() {this->SetXValues(VTK_XYPLOT_VALUE);};
00179 const char *GetXValuesAsString();
00181
00182
00183
00184
00185
00186
00188 void AddDataObjectInput(vtkDataObject *in);
00189
00191 void RemoveDataObjectInput(vtkDataObject *in);
00192
00194
00195 vtkDataObjectCollection *GetDataObjectInputList()
00196 {return this->DataObjectInputList;}
00198
00200
00202 vtkSetClampMacro(DataObjectPlotMode,int,VTK_XYPLOT_COLUMN,VTK_XYPLOT_ROW);
00203 vtkGetMacro(DataObjectPlotMode,int);
00204 void SetDataObjectPlotModeToRows()
00205 {this->SetDataObjectPlotMode(VTK_XYPLOT_ROW);}
00206 void SetDataObjectPlotModeToColumns()
00207 {this->SetDataObjectPlotMode(VTK_XYPLOT_COLUMN);}
00208 const char *GetDataObjectPlotModeAsString();
00210
00212
00218 void SetDataObjectXComponent(int i, int comp);
00219 int GetDataObjectXComponent(int i);
00221
00223
00229 void SetDataObjectYComponent(int i, int comp);
00230 int GetDataObjectYComponent(int i);
00231
00233
00234
00235
00236
00237
00238
00239 void SetPlotColor(int i, float r, float g, float b);
00240 void SetPlotColor(int i, const float color[3]) {
00241 this->SetPlotColor(i, color[0], color[1], color[2]); };
00242 float *GetPlotColor(int i);
00243 void SetPlotSymbol(int i,vtkPolyData *input);
00244 vtkPolyData *GetPlotSymbol(int i);
00245 void SetPlotLabel(int i, const char *label);
00246 const char *GetPlotLabel(int i);
00247
00248
00249
00250
00251 vtkGetMacro(PlotCurvePoints, int);
00252 vtkSetMacro(PlotCurvePoints, int);
00253 vtkBooleanMacro(PlotCurvePoints, int);
00254
00255 vtkGetMacro(PlotCurveLines, int);
00256 vtkSetMacro(PlotCurveLines, int);
00257 vtkBooleanMacro(PlotCurveLines, int);
00258
00259 void SetPlotLines(int i, int);
00260 int GetPlotLines(int i);
00261
00262 void SetPlotPoints(int i, int);
00263 int GetPlotPoints(int i);
00264
00265
00267
00269 vtkSetMacro(ExchangeAxes, int);
00270 vtkGetMacro(ExchangeAxes, int);
00271 vtkBooleanMacro(ExchangeAxes, int);
00273
00275
00279 vtkSetMacro(ReverseXAxis, int);
00280 vtkGetMacro(ReverseXAxis, int);
00281 vtkBooleanMacro(ReverseXAxis, int);
00283
00285
00289 vtkSetMacro(ReverseYAxis, int);
00290 vtkGetMacro(ReverseYAxis, int);
00291 vtkBooleanMacro(ReverseYAxis, int);
00293
00295
00299 vtkLegendBoxActor *GetLegendBoxActor()
00300 {return this->LegendActor;}
00301 vtkGlyphSource2D *GetGlyphSource()
00302 {return this->GlyphSource;}
00304
00306
00308 vtkSetStringMacro(Title);
00309 vtkGetStringMacro(Title);
00310 vtkSetStringMacro(XTitle);
00311 vtkGetStringMacro(XTitle);
00312 vtkSetStringMacro(YTitle);
00313 vtkGetStringMacro(YTitle);
00315
00317
00323 vtkSetVector2Macro(XRange,float);
00324 vtkGetVectorMacro(XRange,float,2);
00325 vtkSetVector2Macro(YRange,float);
00326 vtkGetVectorMacro(YRange,float,2);
00327 void SetPlotRange(float xmin, float ymin, float xmax, float ymax)
00328 {this->SetXRange(xmin,xmax); this->SetYRange(ymin,ymax);}
00330
00332
00337 vtkSetClampMacro(NumberOfXLabels, int, 0, 50);
00338 vtkGetMacro(NumberOfXLabels, int);
00339 vtkSetClampMacro(NumberOfYLabels, int, 0, 50);
00340 vtkGetMacro(NumberOfYLabels, int);
00341 void SetNumberOfLabels(int num)
00342 {this->SetNumberOfXLabels(num); this->SetNumberOfYLabels(num);}
00344
00346
00349 vtkSetMacro(Legend, int);
00350 vtkGetMacro(Legend, int);
00351 vtkBooleanMacro(Legend, int);
00353
00355
00361 vtkSetVector2Macro(LegendPosition,float);
00362 vtkGetVector2Macro(LegendPosition,float);
00363 vtkSetVector2Macro(LegendPosition2,float);
00364 vtkGetVector2Macro(LegendPosition2,float);
00366
00368
00369 vtkSetMacro(Bold, int);
00370 vtkGetMacro(Bold, int);
00371 vtkBooleanMacro(Bold, int);
00373
00375
00376 vtkSetMacro(Italic, int);
00377 vtkGetMacro(Italic, int);
00378 vtkBooleanMacro(Italic, int);
00380
00382
00384 vtkSetMacro(Shadow, int);
00385 vtkGetMacro(Shadow, int);
00386 vtkBooleanMacro(Shadow, int);
00388
00390
00391 vtkSetMacro(Logx, int);
00392 vtkGetMacro(Logx, int);
00393 vtkBooleanMacro(Logx, int);
00395
00397
00400 vtkSetMacro(FontFamily, int);
00401 vtkGetMacro(FontFamily, int);
00402 void SetFontFamilyToArial() {this->SetFontFamily(VTK_ARIAL);};
00403 void SetFontFamilyToCourier() {this->SetFontFamily(VTK_COURIER);};
00404 void SetFontFamilyToTimes() {this->SetFontFamily(VTK_TIMES);};
00406
00408
00409 vtkSetStringMacro(LabelFormat);
00410 vtkGetStringMacro(LabelFormat);
00412
00414
00416 vtkSetClampMacro(Border, int, 0, 50);
00417 vtkGetMacro(Border, int);
00419
00421
00424 vtkGetMacro(PlotPoints, int);
00425 vtkSetMacro(PlotPoints, int);
00426 vtkBooleanMacro(PlotPoints, int);
00428
00430
00432 vtkGetMacro(PlotLines, int);
00433 vtkSetMacro(PlotLines, int);
00434 vtkBooleanMacro(PlotLines, int);
00436
00438
00441 vtkSetClampMacro(GlyphSize, float, 0.0, 0.2);
00442 vtkGetMacro(GlyphSize, float);
00444
00447 void ViewportToPlotCoordinate(vtkViewport *viewport, float &u, float &v);
00448
00450
00453 void ViewportToPlotCoordinate(vtkViewport *viewport);
00454 vtkSetVector2Macro(PlotCoordinate,float);
00455 vtkGetVector2Macro(PlotCoordinate,float);
00457
00459 void PlotToViewportCoordinate(vtkViewport *viewport, float &u, float &v);
00460
00462
00466 void PlotToViewportCoordinate(vtkViewport *viewport);
00467 vtkSetVector2Macro(ViewportCoordinate,float);
00468 vtkGetVector2Macro(ViewportCoordinate,float);
00470
00473 int IsInPlot(vtkViewport *viewport, float u, float v);
00474
00476 unsigned long GetMTime();
00477
00478
00480
00481 THIS METHOD OUTSIDE OF THE RENDERING PROCESS. Draw the x-y plot. */
00482 int RenderOpaqueGeometry(vtkViewport*);
00483 int RenderOverlay(vtkViewport*);
00484 int RenderTranslucentGeometry(vtkViewport *) {return 0;}
00486
00490 void ReleaseGraphicsResources(vtkWindow *);
00491
00492
00493 protected:
00494 vtkXYPlotActor();
00495 ~vtkXYPlotActor();
00496
00497 vtkDataSetCollection *InputList;
00498 vtkDataObjectCollection *DataObjectInputList;
00499 char *Title;
00500 char *XTitle;
00501 char *YTitle;
00502 int XValues;
00503 int NumberOfXLabels;
00504 int NumberOfYLabels;
00505 int Bold;
00506 int Italic;
00507 int Shadow;
00508 int FontFamily;
00509 int Logx;
00510 char *LabelFormat;
00511 float XRange[2];
00512 float YRange[2];
00513 float XComputedRange[2];
00514 float YComputedRange[2];
00515 int Border;
00516 int PlotLines;
00517 int PlotPoints;
00518 int PlotCurveLines;
00519 int PlotCurvePoints;
00520 int ExchangeAxes;
00521 int ReverseXAxis;
00522 int ReverseYAxis;
00523
00524 vtkTextMapper *TitleMapper;
00525 vtkActor2D *TitleActor;
00526
00527 vtkAxisActor2D *XAxis;
00528 vtkAxisActor2D *YAxis;
00529
00530 float ViewportCoordinate[2];
00531 float PlotCoordinate[2];
00532
00533
00534 int DataObjectPlotMode;
00535 vtkIntArray *XComponent;
00536 vtkIntArray *YComponent;
00537 vtkIntArray *LinesOn;
00538 vtkIntArray *PointsOn;
00539
00540
00541
00542
00543 int NumberOfInputs;
00544 vtkPolyData **PlotData;
00545 vtkGlyph2D **PlotGlyph;
00546 vtkAppendPolyData **PlotAppend;
00547 vtkPolyDataMapper2D **PlotMapper;
00548 vtkActor2D **PlotActor;
00549 void InitializeEntries();
00550
00551
00552
00553 int Legend;
00554 float LegendPosition[2];
00555 float LegendPosition2[2];
00556 vtkLegendBoxActor *LegendActor;
00557 vtkGlyphSource2D *GlyphSource;
00558 vtkPlanes *ClipPlanes;
00559 float GlyphSize;
00560
00561
00562 int CachedSize[2];
00563 vtkTimeStamp BuildTime;
00564
00565 void ComputeXRange(float range[2], float *lengths);
00566 void ComputeYRange(float range[2]);
00567 void ComputeDORange(float xrange[2], float yrange[2], float *lengths);
00568
00569 virtual void CreatePlotData(int *pos, int *pos2, float xRange[2],
00570 float yRange[2], float *norms,
00571 int numDS, int numDO);
00572 void PlaceAxes(vtkViewport *viewport, int *size, int pos[2], int pos2[2]);
00573 void GenerateClipPlanes(int *pos, int *pos2);
00574 float ComputeGlyphScale(int i, int *pos, int *pos2);
00575 void ClipPlotData(int *pos, int *pos2, vtkPolyData *pd);
00576 float *TransformPoint(int pos[2], int pos2[2], float x[3], float xNew[3]);
00577
00578 private:
00579 vtkXYPlotActor(const vtkXYPlotActor&);
00580 void operator=(const vtkXYPlotActor&);
00581 };
00582
00583
00584 #endif
00585