00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
00042 class KDCHART_EXPORT CartesianCoordinatePlane : public AbstractCoordinatePlane
00043 {
00044 Q_OBJECT
00045
00046 Q_DISABLE_COPY( CartesianCoordinatePlane )
00047 KDCHART_DECLARE_PRIVATE_DERIVED_PARENT( CartesianCoordinatePlane, Chart* )
00048
00049 friend class CartesianAxis;
00050 friend class CartesianGrid;
00051
00052 public:
00053 explicit CartesianCoordinatePlane ( Chart* parent = 0 );
00054 ~CartesianCoordinatePlane();
00055
00056 void addDiagram ( AbstractDiagram* diagram );
00057
00058 void setIsometricScaling ( bool onOff );
00059
00060 bool doesIsometricScaling() const;
00061
00062 const QPointF translate ( const QPointF& diagramPoint ) const;
00063
00067 virtual double zoomFactorX() const;
00071 virtual double zoomFactorY() const;
00072
00076 virtual void setZoomFactorX( double factor );
00080 virtual void setZoomFactorY( double factor );
00081
00085 virtual QPointF zoomCenter() const;
00086
00090 virtual void setZoomCenter( const QPointF& center );
00091
00092 void setFixedDataCoordinateSpaceRelation( bool fixed );
00093 bool hasFixedDataCoordinateSpaceRelation() const;
00094
00095
00124 void setHorizontalRange( const QPair<qreal, qreal> & range );
00125
00154 void setVerticalRange( const QPair<qreal, qreal> & range );
00155
00163 QPair<qreal, qreal> horizontalRange() const;
00164
00172 QPair<qreal, qreal> verticalRange() const;
00173
00194 void setAutoAdjustHorizontalRangeToData( unsigned int percentEmpty = 67 );
00195
00216 void setAutoAdjustVerticalRangeToData( unsigned int percentEmpty = 67 );
00217
00228 unsigned int autoAdjustHorizontalRangeToData() const;
00229
00240 unsigned int autoAdjustVerticalRangeToData() const;
00241
00242
00264 void setGridAttributes( Qt::Orientation orientation, const GridAttributes & );
00265
00277 void resetGridAttributes( Qt::Orientation orientation );
00278
00293 const GridAttributes gridAttributes( Qt::Orientation orientation ) const;
00294
00307 bool hasOwnGridAttributes( Qt::Orientation orientation ) const;
00308
00316 void setAutoAdjustGridToZoom( bool autoAdjust );
00317
00323 const bool autoAdjustGridToZoom() const;
00324
00325 AxesCalcMode axesCalcModeY() const;
00326 AxesCalcMode axesCalcModeX() const;
00327
00329 void setAxesCalcModes( AxesCalcMode mode );
00331 void setAxesCalcModeY( AxesCalcMode mode );
00333 void setAxesCalcModeX( AxesCalcMode mode );
00334
00336 virtual void paint( QPainter* );
00337
00339 AbstractCoordinatePlane* sharedAxisMasterPlane( QPainter* p = 0 );
00340
00345 QRectF visibleDataRange() const;
00346
00353 void setHorizontalRangeReversed( bool reverse );
00354
00358 bool isHorizontalRangeReversed() const;
00359
00366 void setVerticalRangeReversed( bool reverse );
00367
00371 bool isVerticalRangeReversed() const;
00372
00376 void setGeometry( const QRect& r );
00377
00378 public Q_SLOTS:
00387 void adjustRangesToData();
00388
00393 void adjustHorizontalRangeToData();
00394
00399 void adjustVerticalRangeToData();
00400
00401
00402 protected:
00403 QRectF getRawDataBoundingRectFromDiagrams() const;
00404 QRectF adjustedToMaxEmptyInnerPercentage(
00405 const QRectF& r, unsigned int percentX, unsigned int percentY ) const;
00406 virtual QRectF calculateRawDataBoundingRect() const;
00407 virtual DataDimensionsList getDataDimensionsList() const;
00408
00409
00410 virtual QRectF drawingArea() const;
00411 const QPointF translateBack( const QPointF& screenPoint ) const;
00412 void paintEvent ( QPaintEvent* );
00413 void layoutDiagrams();
00414 bool doneSetZoomFactorX( double factor );
00415 bool doneSetZoomFactorY( double factor );
00416 bool doneSetZoomCenter( const QPointF& center );
00417
00418 void handleFixedDataCoordinateSpaceRelation( const QRectF& geometry );
00419
00420 protected Q_SLOTS:
00421 void slotLayoutChanged( AbstractDiagram* );
00422
00423 private:
00424 void setHasOwnGridAttributes(
00425 Qt::Orientation orientation, bool on );
00426 };
00427
00428 }
00429
00430 #endif