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 "vtkRenderingAnnotationModule.h" // For export macro 00055 #include "vtkActor2D.h" 00056 00057 class vtkAlgorithmOutput; 00058 class vtkAxisActor2D; 00059 class vtkDataObject; 00060 class vtkPolyData; 00061 class vtkPolyDataMapper2D; 00062 class vtkTextMapper; 00063 class vtkTextProperty; 00064 class vtkLegendBoxActor; 00065 class vtkGlyphSource2D; 00066 class vtkAxisLabelArray; 00067 class vtkAxisRanges; 00068 class vtkSpiderPlotActorConnection; 00069 00070 00071 #define VTK_IV_COLUMN 0 00072 #define VTK_IV_ROW 1 00073 00074 class VTKRENDERINGANNOTATION_EXPORT vtkSpiderPlotActor : public vtkActor2D 00075 { 00076 public: 00078 00079 vtkTypeMacro(vtkSpiderPlotActor,vtkActor2D); 00080 void PrintSelf(ostream& os, vtkIndent indent); 00082 00084 static vtkSpiderPlotActor *New(); 00085 00087 00089 virtual void SetInputData(vtkDataObject*); 00090 virtual void SetInputConnection(vtkAlgorithmOutput*); 00092 00094 virtual vtkDataObject* GetInput(); 00095 00097 00100 vtkSetClampMacro(IndependentVariables,int,VTK_IV_COLUMN, VTK_IV_ROW); 00101 vtkGetMacro(IndependentVariables,int); 00102 void SetIndependentVariablesToColumns() 00103 {this->SetIndependentVariables(VTK_IV_COLUMN);}; 00104 void SetIndependentVariablesToRows() 00105 {this->SetIndependentVariables(VTK_IV_ROW);}; 00107 00109 00110 vtkSetMacro(TitleVisibility, int); 00111 vtkGetMacro(TitleVisibility, int); 00112 vtkBooleanMacro(TitleVisibility, int); 00114 00116 00117 vtkSetStringMacro(Title); 00118 vtkGetStringMacro(Title); 00120 00122 00123 virtual void SetTitleTextProperty(vtkTextProperty *p); 00124 vtkGetObjectMacro(TitleTextProperty,vtkTextProperty); 00126 00127 // Enable/Disable the display axes titles. These are arranged on the end 00128 // of each radial axis on the circumference of the spider plot. The label 00129 // text strings are derived from the names of the data object arrays 00130 // associated with the input. 00131 vtkSetMacro(LabelVisibility, int); 00132 vtkGetMacro(LabelVisibility, int); 00133 vtkBooleanMacro(LabelVisibility, int); 00134 00136 00139 virtual void SetLabelTextProperty(vtkTextProperty *p); 00140 vtkGetObjectMacro(LabelTextProperty,vtkTextProperty); 00142 00144 00146 vtkSetClampMacro(NumberOfRings,int,0,VTK_INT_MAX); 00147 vtkGetMacro(NumberOfRings,int); 00149 00151 00153 void SetAxisLabel(const int i, const char *); 00154 const char* GetAxisLabel(int i); 00156 00158 00160 void SetAxisRange(int i, double min, double max); 00161 void SetAxisRange(int i, double range[2]); 00162 void GetAxisRange(int i, double range[2]); 00164 00166 00168 void SetPlotColor(int i, double r, double g, double b); 00169 void SetPlotColor(int i, const double color[3]) 00170 { this->SetPlotColor(i, color[0], color[1], color[2]); } 00171 double *GetPlotColor(int i); 00173 00175 00178 vtkSetMacro(LegendVisibility, int); 00179 vtkGetMacro(LegendVisibility, int); 00180 vtkBooleanMacro(LegendVisibility, int); 00182 00184 00186 vtkGetObjectMacro(LegendActor,vtkLegendBoxActor); 00188 00190 00191 int RenderOverlay(vtkViewport*); 00192 int RenderOpaqueGeometry(vtkViewport*); 00193 virtual int RenderTranslucentPolygonalGeometry(vtkViewport* ) {return 0;} 00195 00197 virtual int HasTranslucentPolygonalGeometry(); 00198 00202 void ReleaseGraphicsResources(vtkWindow *); 00203 00204 protected: 00205 vtkSpiderPlotActor(); 00206 ~vtkSpiderPlotActor(); 00207 00208 private: 00209 00210 vtkSpiderPlotActorConnection* ConnectionHolder; 00211 00212 int IndependentVariables; // Use column or row 00213 int TitleVisibility; // Should I see the title? 00214 char *Title; // The title string 00215 vtkTextProperty *TitleTextProperty; 00216 int LabelVisibility; 00217 vtkTextProperty *LabelTextProperty; 00218 vtkAxisLabelArray *Labels; 00219 int LegendVisibility; 00220 vtkLegendBoxActor *LegendActor; 00221 vtkGlyphSource2D *GlyphSource; 00222 int NumberOfRings; 00223 int AutomaticRangeComputation; 00224 00225 // Local variables needed to plot 00226 vtkIdType N; // The number of independent variables 00227 double *Mins; // Minimum data value along this row/column 00228 double *Maxs; // Maximum data value along this row/column 00229 vtkAxisRanges *Ranges; 00230 00231 vtkTextMapper **LabelMappers; //a label for each radial spoke 00232 vtkActor2D **LabelActors; 00233 00234 vtkTextMapper *TitleMapper; 00235 vtkActor2D *TitleActor; 00236 00237 vtkPolyData *WebData; // The web of the spider plot 00238 vtkPolyDataMapper2D *WebMapper; 00239 vtkActor2D *WebActor; 00240 00241 vtkPolyData *PlotData; // The lines drawn within the axes 00242 vtkPolyDataMapper2D *PlotMapper; 00243 vtkActor2D *PlotActor; 00244 00245 vtkTimeStamp BuildTime; 00246 00247 double Center[3]; 00248 double Radius; 00249 double Theta; 00250 00251 int LastPosition[2]; 00252 int LastPosition2[2]; 00253 double P1[3]; 00254 double P2[3]; 00255 00256 void Initialize(); 00257 int PlaceAxes(vtkViewport *viewport, int *size); 00258 int BuildPlot(vtkViewport*); 00259 00260 private: 00261 vtkSpiderPlotActor(const vtkSpiderPlotActor&); // Not implemented. 00262 void operator=(const vtkSpiderPlotActor&); // Not implemented. 00263 }; 00264 00265 00266 #endif 00267