VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkSpiderPlotActor.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00051 #ifndef __vtkSpiderPlotActor_h 00052 #define __vtkSpiderPlotActor_h 00053 00054 #include "vtkActor2D.h" 00055 00056 class vtkAxisActor2D; 00057 class vtkDataObject; 00058 class vtkPolyData; 00059 class vtkPolyDataMapper2D; 00060 class vtkTextMapper; 00061 class vtkTextProperty; 00062 class vtkLegendBoxActor; 00063 class vtkGlyphSource2D; 00064 class vtkAxisLabelArray; 00065 class vtkAxisRanges; 00066 00067 00068 #define VTK_IV_COLUMN 0 00069 #define VTK_IV_ROW 1 00070 00071 class VTK_HYBRID_EXPORT vtkSpiderPlotActor : public vtkActor2D 00072 { 00073 public: 00075 00076 vtkTypeMacro(vtkSpiderPlotActor,vtkActor2D); 00077 void PrintSelf(ostream& os, vtkIndent indent); 00079 00081 static vtkSpiderPlotActor *New(); 00082 00084 virtual void SetInput(vtkDataObject*); 00085 00087 00088 vtkGetObjectMacro(Input,vtkDataObject); 00090 00092 00095 vtkSetClampMacro(IndependentVariables,int,VTK_IV_COLUMN, VTK_IV_ROW); 00096 vtkGetMacro(IndependentVariables,int); 00097 void SetIndependentVariablesToColumns() 00098 {this->SetIndependentVariables(VTK_IV_COLUMN);}; 00099 void SetIndependentVariablesToRows() 00100 {this->SetIndependentVariables(VTK_IV_ROW);}; 00102 00104 00105 vtkSetMacro(TitleVisibility, int); 00106 vtkGetMacro(TitleVisibility, int); 00107 vtkBooleanMacro(TitleVisibility, int); 00109 00111 00112 vtkSetStringMacro(Title); 00113 vtkGetStringMacro(Title); 00115 00117 00118 virtual void SetTitleTextProperty(vtkTextProperty *p); 00119 vtkGetObjectMacro(TitleTextProperty,vtkTextProperty); 00121 00122 // Enable/Disable the display axes titles. These are arranged on the end 00123 // of each radial axis on the circumference of the spider plot. The label 00124 // text strings are derived from the names of the data object arrays 00125 // associated with the input. 00126 vtkSetMacro(LabelVisibility, int); 00127 vtkGetMacro(LabelVisibility, int); 00128 vtkBooleanMacro(LabelVisibility, int); 00129 00131 00134 virtual void SetLabelTextProperty(vtkTextProperty *p); 00135 vtkGetObjectMacro(LabelTextProperty,vtkTextProperty); 00137 00139 00141 vtkSetClampMacro(NumberOfRings,int,0,VTK_LARGE_INTEGER); 00142 vtkGetMacro(NumberOfRings,int); 00144 00146 00148 void SetAxisLabel(const int i, const char *); 00149 const char* GetAxisLabel(int i); 00151 00153 00155 void SetAxisRange(int i, double min, double max); 00156 void SetAxisRange(int i, double range[2]); 00157 void GetAxisRange(int i, double range[2]); 00159 00161 00163 void SetPlotColor(int i, double r, double g, double b); 00164 void SetPlotColor(int i, const double color[3]) 00165 { this->SetPlotColor(i, color[0], color[1], color[2]); } 00166 double *GetPlotColor(int i); 00168 00170 00173 vtkSetMacro(LegendVisibility, int); 00174 vtkGetMacro(LegendVisibility, int); 00175 vtkBooleanMacro(LegendVisibility, int); 00177 00179 00181 vtkGetObjectMacro(LegendActor,vtkLegendBoxActor); 00183 00185 00186 int RenderOverlay(vtkViewport*); 00187 int RenderOpaqueGeometry(vtkViewport*); 00188 virtual int RenderTranslucentPolygonalGeometry(vtkViewport* ) {return 0;} 00190 00192 virtual int HasTranslucentPolygonalGeometry(); 00193 00197 void ReleaseGraphicsResources(vtkWindow *); 00198 00199 protected: 00200 vtkSpiderPlotActor(); 00201 ~vtkSpiderPlotActor(); 00202 00203 private: 00204 vtkDataObject *Input; // List of data sets to plot 00205 int IndependentVariables; // Use column or row 00206 int TitleVisibility; // Should I see the title? 00207 char *Title; // The title string 00208 vtkTextProperty *TitleTextProperty; 00209 int LabelVisibility; 00210 vtkTextProperty *LabelTextProperty; 00211 vtkAxisLabelArray *Labels; 00212 int LegendVisibility; 00213 vtkLegendBoxActor *LegendActor; 00214 vtkGlyphSource2D *GlyphSource; 00215 int NumberOfRings; 00216 int AutomaticRangeComputation; 00217 00218 // Local variables needed to plot 00219 vtkIdType N; // The number of independent variables 00220 double *Mins; // Minimum data value along this row/column 00221 double *Maxs; // Maximum data value along this row/column 00222 vtkAxisRanges *Ranges; 00223 00224 vtkTextMapper **LabelMappers; //a label for each radial spoke 00225 vtkActor2D **LabelActors; 00226 00227 vtkTextMapper *TitleMapper; 00228 vtkActor2D *TitleActor; 00229 00230 vtkPolyData *WebData; // The web of the spider plot 00231 vtkPolyDataMapper2D *WebMapper; 00232 vtkActor2D *WebActor; 00233 00234 vtkPolyData *PlotData; // The lines drawn within the axes 00235 vtkPolyDataMapper2D *PlotMapper; 00236 vtkActor2D *PlotActor; 00237 00238 vtkTimeStamp BuildTime; 00239 00240 double Center[3]; 00241 double Radius; 00242 double Theta; 00243 00244 int LastPosition[2]; 00245 int LastPosition2[2]; 00246 double P1[3]; 00247 double P2[3]; 00248 00249 void Initialize(); 00250 int PlaceAxes(vtkViewport *viewport, int *size); 00251 int BuildPlot(vtkViewport*); 00252 00253 private: 00254 vtkSpiderPlotActor(const vtkSpiderPlotActor&); // Not implemented. 00255 void operator=(const vtkSpiderPlotActor&); // Not implemented. 00256 }; 00257 00258 00259 #endif 00260