VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkPlotBar.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 =========================================================================*/ 00015 00027 #ifndef vtkPlotBar_h 00028 #define vtkPlotBar_h 00029 00030 #include "vtkChartsCoreModule.h" // For export macro 00031 #include "vtkPlot.h" 00032 #include "vtkSmartPointer.h" // Needed to hold ColorSeries 00033 00034 class vtkContext2D; 00035 class vtkTable; 00036 class vtkPoints2D; 00037 class vtkStdString; 00038 class vtkColorSeries; 00039 class vtkUnsignedCharArray; 00040 class vtkScalarsToColors; 00041 00042 class vtkPlotBarPrivate; 00043 00044 class VTKCHARTSCORE_EXPORT vtkPlotBar : public vtkPlot 00045 { 00046 public: 00047 vtkTypeMacro(vtkPlotBar, vtkPlot); 00048 virtual void PrintSelf(ostream &os, vtkIndent indent); 00049 00051 00052 enum { 00053 VERTICAL = 0, 00054 HORIZONTAL 00055 }; 00057 00059 static vtkPlotBar *New(); 00060 00063 virtual void Update(); 00064 00067 virtual bool Paint(vtkContext2D *painter); 00068 00070 00075 virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect, 00076 int legendIndex); 00078 00080 00081 virtual void SetColor(unsigned char r, unsigned char g, unsigned char b, 00082 unsigned char a); 00083 virtual void SetColor(double r, double g, double b); 00084 virtual void GetColor(double rgb[3]); 00086 00088 00089 vtkSetMacro(Width, float); 00091 00093 00094 vtkGetMacro(Width, float); 00096 00098 00101 vtkSetMacro(Offset, float); 00102 vtkGetMacro(Offset, float); 00104 00106 00108 virtual void SetOrientation(int orientation); 00109 vtkGetMacro(Orientation, int); 00111 00113 virtual void GetBounds(double bounds[4], bool unscaled); 00114 00116 virtual void GetBounds(double bounds[4]); 00117 00119 virtual void GetUnscaledInputBounds(double bounds[4]); 00120 00122 virtual void SetInputArray(int index, const vtkStdString &name); 00123 00125 void SetColorSeries(vtkColorSeries *colorSeries); 00126 00128 vtkColorSeries *GetColorSeries(); 00129 00131 00132 virtual void SetLookupTable(vtkScalarsToColors *lut); 00133 virtual vtkScalarsToColors *GetLookupTable(); 00135 00138 virtual void CreateDefaultLookupTable(); 00139 00141 00143 vtkSetMacro(ScalarVisibility, bool); 00144 vtkGetMacro(ScalarVisibility, bool); 00145 vtkBooleanMacro(ScalarVisibility, bool); 00147 00149 00152 void SelectColorArray(vtkIdType arrayNum); 00153 void SelectColorArray(const vtkStdString& arrayName); 00155 00157 vtkStdString GetColorArrayName(); 00158 00160 virtual vtkStringArray *GetLabels(); 00161 00163 virtual void SetGroupName(const vtkStdString& name); 00164 00166 virtual vtkStdString GetGroupName(); 00167 00169 00171 virtual vtkStdString GetTooltipLabel(const vtkVector2d &plotPos, 00172 vtkIdType seriesIndex, 00173 vtkIdType segmentIndex); 00175 00177 virtual bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max); 00178 00179 //BTX 00181 00184 virtual vtkIdType GetNearestPoint(const vtkVector2f& point, 00185 const vtkVector2f& tolerance, 00186 vtkVector2f* location); 00188 00190 00195 virtual vtkIdType GetNearestPoint(const vtkVector2f& point, 00196 const vtkVector2f&, 00197 vtkVector2f* location, 00198 vtkIdType* segmentIndex); 00200 00202 int GetBarsCount(); 00203 00205 void GetDataBounds(double bounds[2]); 00206 00207 protected: 00208 vtkPlotBar(); 00209 ~vtkPlotBar(); 00210 00212 bool UpdateTableCache(vtkTable *table); 00213 00215 vtkPoints2D *Points; 00216 00217 float Width; 00218 float Offset; 00219 00220 int Orientation; 00221 00223 vtkTimeStamp BuildTime; 00224 00226 vtkSmartPointer<vtkColorSeries> ColorSeries; 00227 00229 00230 vtkSmartPointer<vtkScalarsToColors> LookupTable; 00231 vtkSmartPointer<vtkUnsignedCharArray> Colors; 00232 bool ScalarVisibility; 00233 vtkStdString ColorArrayName; 00235 00236 bool LogX; 00237 bool LogY; 00238 00239 private: 00240 vtkPlotBar(const vtkPlotBar &); // Not implemented. 00241 void operator=(const vtkPlotBar &); // Not implemented. 00242 00243 vtkPlotBarPrivate *Private; 00244 00245 //ETX 00246 }; 00247 00248 #endif //vtkPlotBar_h