00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkChartXY.h,v $ 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 __vtkChartXY_h 00027 #define __vtkChartXY_h 00028 00029 #include "vtkChart.h" 00030 00031 class vtkPlot; 00032 class vtkAxis; 00033 class vtkPlotGrid; 00034 class vtkTable; 00035 class vtkChartLegend; 00036 class vtkTooltipItem; 00037 class vtkContextMouseEvent; 00038 class vtkChartXYPrivate; // Private class to keep my STL vector in... 00039 00040 class VTK_CHARTS_EXPORT vtkChartXY : public vtkChart 00041 { 00042 public: 00043 vtkTypeRevisionMacro(vtkChartXY, vtkChart); 00044 virtual void PrintSelf(ostream &os, vtkIndent indent); 00045 00047 static vtkChartXY *New(); 00048 00052 virtual void Update(); 00053 00056 virtual bool Paint(vtkContext2D *painter); 00057 00059 virtual vtkPlot * AddPlot(int type); 00060 00063 virtual bool RemovePlot(vtkIdType index); 00064 00066 virtual void ClearPlots(); 00067 00070 virtual vtkPlot* GetPlot(vtkIdType index); 00071 00073 virtual vtkIdType GetNumberOfPlots(); 00074 00078 virtual vtkAxis* GetAxis(int axisIndex); 00079 00081 virtual vtkIdType GetNumberOfAxes(); 00082 00086 virtual void RecalculateBounds(); 00087 00089 00090 vtkSetMacro(DrawAxesAtOrigin, bool); 00091 vtkGetMacro(DrawAxesAtOrigin, bool); 00093 00095 00101 vtkSetMacro(BarWidthFraction, float); 00102 vtkGetMacro(BarWidthFraction, float); 00104 00105 //BTX 00107 virtual bool Hit(const vtkContextMouseEvent &mouse); 00108 00110 virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse); 00111 00113 virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse); 00114 00116 virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse); 00117 00119 virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse); 00120 00122 virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse); 00123 00126 virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta); 00127 //ETX 00128 00131 virtual void SetScene(vtkContextScene *scene); 00132 00133 //BTX 00134 protected: 00135 vtkChartXY(); 00136 ~vtkChartXY(); 00137 00140 void RecalculatePlotTransform(); 00141 00144 void RecalculatePlotBounds(); 00145 00147 virtual void ProcessSelectionEvent(vtkObject* caller, void* callData); 00148 00150 vtkPlotGrid *Grid; 00151 00153 vtkChartLegend *Legend; 00154 00157 vtkTooltipItem *Tooltip; 00158 00160 vtkTransform2D *PlotTransform; 00161 00163 bool PlotTransformValid; 00164 00166 float BoxOrigin[2]; 00167 00169 float BoxGeometry[2]; 00170 00172 bool DrawBox; 00173 00175 bool DrawNearestPoint; 00176 00180 bool DrawAxesAtOrigin; 00181 00184 float BarWidthFraction; 00185 00186 private: 00187 vtkChartXY(const vtkChartXY &); // Not implemented. 00188 void operator=(const vtkChartXY &); // Not implemented. 00189 00190 vtkChartXYPrivate *ChartPrivate; // Private class where I hide my STL containers 00191 00193 void RenderPlots(vtkContext2D *painter); 00194 00197 void CalculateBarPlots(); 00198 00200 bool LocatePointInPlots(const vtkContextMouseEvent &mouse); 00201 00202 //ETX 00203 }; 00204 00205 #endif //__vtkChartXY_h