KDChartPlotter.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB.  All rights reserved.
00003 **
00004 ** This file is part of the KD Chart library.
00005 **
00006 ** Licensees holding valid commercial KD Chart licenses may use this file in
00007 ** accordance with the KD Chart Commercial License Agreement provided with
00008 ** the Software.
00009 **
00010 **
00011 ** This file may be distributed and/or modified under the terms of the
00012 ** GNU General Public License version 2 and version 3 as published by the
00013 ** Free Software Foundation and appearing in the file LICENSE.GPL included.
00014 **
00015 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00017 **
00018 ** Contact info@kdab.com if any conditions of this licensing are not
00019 ** clear to you.
00020 **
00021 **********************************************************************/
00022 
00023 #ifndef KDCHARTPLOTTER_H
00024 #define KDCHARTPLOTTER_H
00025 
00026 #include "KDChartAbstractCartesianDiagram.h"
00027 
00028 #include "KDChartLineAttributes.h"
00029 #include "KDChartValueTrackerAttributes.h"
00030 
00031 namespace KDChart {
00032 
00033     class ThreeDLineAttributes;
00034 
00038 class KDCHART_EXPORT Plotter : public AbstractCartesianDiagram
00039 {
00040     Q_OBJECT
00041 
00042     Q_DISABLE_COPY( Plotter )
00043 
00044     KDCHART_DECLARE_DERIVED_DIAGRAM( Plotter, CartesianCoordinatePlane )
00045 
00046 
00047 public:
00048     class PlotterType;
00049     friend class PlotterType;
00050 
00051     explicit Plotter( QWidget* parent = 0, CartesianCoordinatePlane* plane = 0 );
00052     virtual ~Plotter();
00053 
00054     virtual Plotter* clone() const;
00055 
00059     bool compare( const Plotter* other ) const;
00060 
00061     enum PlotType {
00062         Normal =  0,
00063         Percent
00064     };
00065 
00066 
00067     void setType( const PlotType type );
00068     PlotType type() const;
00069 
00070     void setLineAttributes( const LineAttributes & a );
00071     void setLineAttributes( int column, const LineAttributes & a );
00072     void setLineAttributes( const QModelIndex & index, const LineAttributes & a );
00073     void resetLineAttributes( int column );
00074     void resetLineAttributes( const QModelIndex & index );
00075     LineAttributes lineAttributes() const;
00076     LineAttributes lineAttributes( int column ) const;
00077     LineAttributes lineAttributes( const QModelIndex & index ) const;
00078 
00079     void setThreeDLineAttributes( const ThreeDLineAttributes & a );
00080     void setThreeDLineAttributes( int column, const ThreeDLineAttributes & a );
00081     void setThreeDLineAttributes( const QModelIndex & index,
00082                                   const ThreeDLineAttributes & a );
00083 
00084     //FIXME(khz): big TODO(khz): add a lot of reset...Attributes() methods to all
00085     // appropriate places, for 2.1 (that is: after we have release 2.0.2)  :-)
00086 
00087     ThreeDLineAttributes threeDLineAttributes() const;
00088     ThreeDLineAttributes threeDLineAttributes( int column ) const;
00089     ThreeDLineAttributes threeDLineAttributes( const QModelIndex & index ) const;
00090 
00091     void setValueTrackerAttributes( const QModelIndex & index,
00092                                     const ValueTrackerAttributes & a );
00093     ValueTrackerAttributes valueTrackerAttributes( const QModelIndex & index ) const;
00094 
00095 #if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE)
00096     // implement AbstractCartesianDiagram
00097     /* reimpl */
00098     const int numberOfAbscissaSegments () const;
00099     /* reimpl */
00100     const int numberOfOrdinateSegments () const;
00101 #else
00102     // implement AbstractCartesianDiagram
00103     /* reimpl */
00104     int numberOfAbscissaSegments () const;
00105     /* reimpl */
00106     int numberOfOrdinateSegments () const;
00107 #endif
00108 
00109 protected:
00110     void paint ( PaintContext* paintContext );
00111 
00112 public:
00113     void resize ( const QSizeF& area );
00114 
00115 protected:
00116     virtual double threeDItemDepth( const QModelIndex & index ) const;
00117     virtual double threeDItemDepth( int column ) const;
00119     virtual const QPair<QPointF, QPointF> calculateDataBoundaries() const;
00120     void paintEvent ( QPaintEvent* );
00121     void resizeEvent ( QResizeEvent* );
00122 }; // End of class KDChart::Plotter
00123 
00124 }
00125 
00126 #endif // KDCHARTLINEDIAGRAM_H