00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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;
00039
00040 class VTK_CHARTS_EXPORT vtkChartXY : public vtkChart
00041 {
00042 public:
00043 vtkTypeMacro(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
00076 int GetPlotCorner(vtkPlot *plot);
00077
00079 void SetPlotCorner(vtkPlot *plot, int corner);
00080
00084 virtual vtkAxis* GetAxis(int axisIndex);
00085
00087 virtual vtkIdType GetNumberOfAxes();
00088
00092 virtual void RecalculateBounds();
00093
00095
00096 vtkSetMacro(DrawAxesAtOrigin, bool);
00097 vtkGetMacro(DrawAxesAtOrigin, bool);
00099
00101
00103 vtkSetMacro(AutoAxes, bool);
00104 vtkGetMacro(AutoAxes, bool);
00106
00107
00109
00115 vtkSetMacro(BarWidthFraction, float);
00116 vtkGetMacro(BarWidthFraction, float);
00118
00119
00121 virtual bool Hit(const vtkContextMouseEvent &mouse);
00122
00124 virtual bool MouseEnterEvent(const vtkContextMouseEvent &mouse);
00125
00127 virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
00128
00130 virtual bool MouseLeaveEvent(const vtkContextMouseEvent &mouse);
00131
00133 virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
00134
00136 virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse);
00137
00140 virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta);
00141
00142
00145 virtual void SetScene(vtkContextScene *scene);
00146
00147
00148 protected:
00149 vtkChartXY();
00150 ~vtkChartXY();
00151
00153 void RecalculatePlotTransforms();
00154
00156
00157 void RecalculatePlotTransform(vtkAxis *x, vtkAxis *y,
00158 vtkTransform2D *transform);
00160
00163 void RecalculatePlotBounds();
00164
00166 virtual void ProcessSelectionEvent(vtkObject* caller, void* callData);
00167
00169
00170 vtkPlotGrid *Grid;
00171 vtkPlotGrid *Grid2;
00173
00175 vtkChartLegend *Legend;
00176
00179 vtkTooltipItem *Tooltip;
00180
00182 bool PlotTransformValid;
00183
00185 float BoxOrigin[2];
00186
00188 float BoxGeometry[2];
00189
00191 bool DrawBox;
00192
00194 bool DrawNearestPoint;
00195
00199 bool DrawAxesAtOrigin;
00200
00202 bool AutoAxes;
00203
00206 float BarWidthFraction;
00207
00210 bool LayoutChanged;
00211
00212 private:
00213 vtkChartXY(const vtkChartXY &);
00214 void operator=(const vtkChartXY &);
00215
00216 vtkChartXYPrivate *ChartPrivate;
00217
00219 void RenderPlots(vtkContext2D *painter);
00220
00223 void CalculateBarPlots();
00224
00226 bool LocatePointInPlots(const vtkContextMouseEvent &mouse);
00227
00229 bool RemovePlotFromCorners(vtkPlot *plot);
00230
00231 void ZoomInAxes(vtkAxis *x, vtkAxis *y, float *orign, float *max);
00232
00233
00234 };
00235
00236 #endif //__vtkChartXY_h