KD Chart 2: KDChartCartesianCoordinatePlane.h Source File

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# KDChartCartesianCoordinatePlane.h

Go to the documentation of this file.

    00001 /****************************************************************************
    00002  ** Copyright (C) 2006 Klarälvdalens Datakonsult AB.  All rights reserved.
    00003  **
    00004  ** This file is part of the KD Chart library.
    00005  **
    00006  ** This file may be distributed and/or modified under the terms of the
    00007  ** GNU General Public License version 2 as published by the Free Software
    00008  ** Foundation and appearing in the file LICENSE.GPL included in the
    00009  ** packaging of this file.
    00010  **
    00011  ** Licensees holding valid commercial KD Chart licenses may use this file in
    00012  ** accordance with the KD Chart Commercial License Agreement provided with
    00013  ** the Software.
    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  ** See http://www.kdab.net/kdchart for
    00019  **   information about KDChart Commercial License Agreements.
    00020  **
    00021  ** Contact info@kdab.net if any conditions of this
    00022  ** licensing are not clear to you.
    00023  **
    00024  **********************************************************************/
    00025
    00026 #ifndef KDCHARTCARTESIANCOORDINATEPLANE_H
    00027 #define KDCHARTCARTESIANCOORDINATEPLANE_H
    00028
    00029 #include "KDChartAbstractCoordinatePlane.h"
    00030
    00031 namespace KDChart {
    00032
    00033     class Chart;
    00034     class PaintContext;
    00035     class AbstractDiagram;
    00036     class CartesianAxis;
    00037     class CartesianGrid;
    00038
    00039     class KDCHART_EXPORT CartesianCoordinatePlane : public AbstractCoordinatePlane
    00040     {
    00041         Q_OBJECT
    00042
    00043         Q_DISABLE_COPY( CartesianCoordinatePlane )
    00044         KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( CartesianCoordinatePlane, Chart* )
    00045
    00046     friend class CartesianAxis;
    00047     friend class CartesianGrid;
    00048
    00049     public:
    00050         explicit CartesianCoordinatePlane ( Chart* parent = 0 );
    00051         ~CartesianCoordinatePlane();
    00052
    00053         void addDiagram ( AbstractDiagram* diagram );
    00054
    00055         void setIsometricScaling ( bool onOff );
    00056
    00057         bool doesIsometricScaling() const;
    00058
    00059         const QPointF translate ( const QPointF& diagramPoint ) const;
    00060
    00064         virtual double zoomFactorX() const;
    00068         virtual double zoomFactorY() const;
    00069
    00073         virtual void setZoomFactorX( double factor );
    00077         virtual void setZoomFactorY( double factor );
    00078
    00082         virtual QPointF zoomCenter() const;
    00083
    00087         virtual void setZoomCenter( QPointF center );
    00088
    00089
    00118         void setHorizontalRange( const QPair<qreal, qreal> & range );
    00119
    00148         void setVerticalRange( const QPair<qreal, qreal> & range );
    00149
    00157         QPair<qreal, qreal> horizontalRange() const;
    00158
    00166         QPair<qreal, qreal> verticalRange() const;
    00167
    00188         void setAutoAdjustHorizontalRangeToData( unsigned int percentEmpty = 67 );
    00189
    00210         void setAutoAdjustVerticalRangeToData( unsigned int percentEmpty = 67  );
    00211
    00222         unsigned int autoAdjustHorizontalRangeToData() const;
    00223
    00234         unsigned int autoAdjustVerticalRangeToData() const;
    00235
    00236
    00258         void setGridAttributes( Qt::Orientation orientation, const GridAttributes & );
    00259
    00271         void resetGridAttributes( Qt::Orientation orientation );
    00272
    00287         const GridAttributes gridAttributes( Qt::Orientation orientation ) const;
    00288
    00301         bool hasOwnGridAttributes( Qt::Orientation orientation ) const;
    00302
    00310         void setAutoAdjustGridToZoom( bool autoAdjust );
    00311
    00317         const bool autoAdjustGridToZoom() const;
    00318
    00319         AxesCalcMode axesCalcModeY() const;
    00320         AxesCalcMode axesCalcModeX() const;
    00321
    00323         void setAxesCalcModes( AxesCalcMode mode );
    00325         void setAxesCalcModeY( AxesCalcMode mode );
    00327         void setAxesCalcModeX( AxesCalcMode mode );
    00328
    00330         virtual void paint( QPainter* );
    00331
    00332
    00333     public Q_SLOTS:
    00342         void adjustRangesToData();
    00343
    00348         void adjustHorizontalRangeToData();
    00349
    00354         void adjustVerticalRangeToData();
    00355
    00356
    00357     protected:
    00358         QRectF getRawDataBoundingRectFromDiagrams() const;
    00359         QRectF adjustedToMaxEmptyInnerPercentage(
    00360                 const QRectF& r, unsigned int percentX, unsigned int percentY ) const;
    00361         virtual QRectF calculateRawDataBoundingRect() const;
    00362         virtual DataDimensionsList getDataDimensionsList() const;
    00363         // the whole drawing area, includes diagrams and axes, but maybe smaller
    00364         // than (width, height):
    00365         virtual QRectF drawingArea() const;
    00366         const QPointF translateBack( const QPointF& screenPoint ) const;
    00367         void paintEvent ( QPaintEvent* );
    00368         void layoutDiagrams();
    00369         bool doneSetZoomFactorX( double factor );
    00370         bool doneSetZoomFactorY( double factor );
    00371         bool doneSetZoomCenter( QPointF center );
    00372
    00373     protected Q_SLOTS:
    00374         void slotLayoutChanged( AbstractDiagram* );
    00375
    00376     private:
    00377         void setHasOwnGridAttributes(
    00378             Qt::Orientation orientation, bool on );
    00379     };
    00380
    00381 }
    00382
    00383 #endif