VTK
dox/GUISupport/Qt/Chart/vtkQtChartAxisLayer.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkQtChartAxisLayer.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 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00020 
00023 
00024 #ifndef _vtkQtChartAxisLayer_h
00025 #define _vtkQtChartAxisLayer_h
00026 
00027 #include "vtkQtChartExport.h"
00028 #include "vtkQtChartLayer.h"
00029 #include "vtkQtChartAxis.h" // Needed for enum
00030 
00031 class vtkQtChartAxisDomain;
00032 class vtkQtChartAxisDomainPriority;
00033 class vtkQtChartAxisLayerItem;
00034 class QFont;
00035 class QGraphicsRectItem;
00036 
00037 
00041 class VTKQTCHART_EXPORT vtkQtChartAxisLayer : public vtkQtChartLayer
00042 {
00043   Q_OBJECT
00044 
00045 public:
00046   enum AxisBehavior
00047     {
00048     ChartSelect = 0, 
00049     BestFit,         
00050     FixedInterval    
00051     };
00052 
00053   enum {Type = vtkQtChart_AxisLayerType};
00054 
00055 public:
00056   vtkQtChartAxisLayer();
00057   virtual ~vtkQtChartAxisLayer();
00058 
00060 
00061 
00062 
00063 
00064 
00065 
00066   vtkQtChartAxis *getAxis(vtkQtChartAxis::AxisLocation location) const;
00067 
00073   vtkQtChartAxis *getHorizontalAxis(vtkQtChartLayer::AxesCorner axes) const;
00074 
00080   vtkQtChartAxis *getVerticalAxis(vtkQtChartLayer::AxesCorner axes) const;
00081 
00087   AxisBehavior getAxisBehavior(vtkQtChartAxis::AxisLocation location) const;
00088 
00093   void setAxisBehavior(vtkQtChartAxis::AxisLocation location,
00094       AxisBehavior behavior);
00095 
00101   const vtkQtChartAxisDomainPriority &getAxisDomainPriority(
00102       vtkQtChartAxis::AxisLocation location) const;
00103 
00108   void setAxisDomainPriority(vtkQtChartAxis::AxisLocation location,
00109       const vtkQtChartAxisDomainPriority &priority);
00111 
00123   virtual void layoutChart(const QRectF &area);
00124 
00132   virtual void setChartArea(vtkQtChartArea *area);
00133 
00138   QRectF getLayerBounds() const {return this->LayerBounds;}
00139 
00140   virtual QRectF boundingRect() const;
00141   virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
00142     QWidget *widget=0);
00143 
00144 public slots:
00146   void handleChartRangeChange();
00147 
00149   void cancelChartRangeChange();
00150 
00151 private:
00153   void setupAxesCorner();
00154 
00160   vtkQtChartAxis::AxisDomain getAxisDomain(
00161       vtkQtChartAxis::AxisLocation location) const;
00162 
00169   vtkQtChartLayer::AxesCorner getCorner(vtkQtChartAxis::AxisLocation first,
00170       vtkQtChartAxis::AxisLocation second) const;
00171 
00179   void findAxisDomain(vtkQtChartAxis::AxisLocation axis,
00180       vtkQtChartAxis::AxisLocation neighbor,
00181       vtkQtChartAxis::AxisDomain neighborDomain,
00182       const vtkQtChartLayerDomain &layerDomain,
00183       vtkQtChartAxisDomain &axisDomain) const;
00184 
00185 private:
00186   QRectF LayerBounds;                 
00187   QGraphicsRectItem *Border;          
00188   vtkQtChartAxis *Axis[4];            
00189   vtkQtChartAxisLayerItem *Option[4]; 
00190   bool RangeChanged;                  
00191 
00192 private:
00193   vtkQtChartAxisLayer(const vtkQtChartAxisLayer &);
00194   vtkQtChartAxisLayer &operator=(const vtkQtChartAxisLayer &);
00195 };
00196 
00197 #endif