VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkChartBox.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 00026 #ifndef vtkChartBox_h 00027 #define vtkChartBox_h 00028 00029 #include "vtkChartsCoreModule.h" // For export macro 00030 #include "vtkChart.h" 00031 00032 class vtkIdTypeArray; 00033 class vtkPlotBox; 00034 class vtkStdString; 00035 class vtkStringArray; 00036 class vtkTooltipItem; 00037 00038 class VTKCHARTSCORE_EXPORT vtkChartBox : public vtkChart 00039 { 00040 public: 00041 vtkTypeMacro(vtkChartBox, vtkChart); 00042 virtual void PrintSelf(ostream &os, vtkIndent indent); 00043 00045 static vtkChartBox* New(); 00046 00050 virtual void Update(); 00051 00054 virtual bool Paint(vtkContext2D *painter); 00055 00057 00058 void SetColumnVisibility(const vtkStdString& name, bool visible); 00059 void SetColumnVisibility(vtkIdType column, bool visible); 00061 00064 void SetColumnVisibilityAll(bool visible); 00065 00067 00068 bool GetColumnVisibility(const vtkStdString& name); 00069 bool GetColumnVisibility(vtkIdType column); 00071 00073 vtkIdType GetColumnId(const vtkStdString& name); 00074 00076 00077 vtkGetObjectMacro(VisibleColumns, vtkStringArray); 00079 00080 // Index of the selected column in the visible columns list. 00081 vtkGetMacro(SelectedColumn, int); 00082 vtkSetMacro(SelectedColumn, int); 00083 00086 virtual vtkPlot* GetPlot(vtkIdType index); 00087 00089 virtual vtkIdType GetNumberOfPlots(); 00090 00092 virtual vtkAxis* GetYAxis(); 00093 00095 virtual float GetXPosition(int index); 00096 00098 virtual vtkIdType GetNumberOfVisibleColumns(); 00099 00102 virtual void SetPlot(vtkPlotBox *plot); 00103 00104 //BTX 00106 virtual bool Hit(const vtkContextMouseEvent &mouse); 00107 00109 virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse); 00110 00112 virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse); 00113 00115 virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse); 00116 00117 //ETX 00118 00120 virtual void SetTooltip(vtkTooltipItem *tooltip); 00121 00123 virtual vtkTooltipItem* GetTooltip(); 00124 00126 00127 virtual void SetTooltipInfo(const vtkContextMouseEvent &, 00128 const vtkVector2d &, 00129 vtkIdType, vtkPlot*, 00130 vtkIdType segmentIndex = -1); 00131 //BTX 00132 protected: 00133 vtkChartBox(); 00134 ~vtkChartBox(); 00136 00138 00139 class Private; 00140 Private *Storage; 00142 00143 bool GeometryValid; 00144 00146 vtkIdTypeArray *Selection; 00147 00149 vtkStringArray *VisibleColumns; 00150 00152 00153 int SelectedColumn; 00154 float SelectedColumnDelta; 00156 00158 vtkTimeStamp BuildTime; 00159 00162 vtkSmartPointer<vtkTooltipItem> Tooltip; 00163 00164 void ResetSelection(); 00165 void UpdateGeometry(vtkContext2D*); 00166 void CalculatePlotTransform(); 00167 void SwapAxes(int a1, int a2); 00168 00170 00173 bool LocatePointInPlots(const vtkContextMouseEvent &mouse, 00174 int invokeEvent = -1); 00176 00177 int LocatePointInPlot(const vtkVector2f &position, 00178 const vtkVector2f &tolerance, vtkVector2f &plotPos, 00179 vtkPlot *plot, vtkIdType &segmentIndex); 00180 00181 private: 00182 vtkChartBox(const vtkChartBox &); // Not implemented. 00183 void operator=(const vtkChartBox &); // Not implemented. 00184 //ETX 00185 }; 00186 00188 00191 struct vtkChartBoxData 00192 { 00193 vtkStdString SeriesName; 00194 vtkVector2f Position; 00195 vtkVector2i ScreenPosition; 00196 int Index; 00197 }; 00199 00200 #endif //vtkChartBox_h