KD Chart 2  [rev.2.5.1]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
KDChartPlotter_p.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2013 Klaralvdalens Datakonsult AB. All rights reserved.
3 **
4 ** This file is part of the KD Chart library.
5 **
6 ** Licensees holding valid commercial KD Chart licenses may use this file in
7 ** accordance with the KD Chart Commercial License Agreement provided with
8 ** the Software.
9 **
10 **
11 ** This file may be distributed and/or modified under the terms of the
12 ** GNU General Public License version 2 and version 3 as published by the
13 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included.
14 **
15 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 **
18 ** Contact info@kdab.com if any conditions of this licensing are not
19 ** clear to you.
20 **
21 **********************************************************************/
22 
23 #include "KDChartPlotter_p.h"
24 #include "KDChartPlotter.h"
25 
26 #include "KDChartPainterSaver_p.h"
28 #include "PaintingHelpers_p.h"
29 
30 using namespace KDChart;
31 
32 Plotter::Private::Private( const Private& rhs )
33  : QObject()
34  , AbstractCartesianDiagram::Private( rhs )
35  , useCompression( rhs.useCompression )
36 {
37 }
38 
39 void Plotter::Private::init()
40 {
41  AbstractCartesianDiagram::Private::init();
42  useCompression = Plotter::NONE;
43 }
44 
45 void Plotter::Private::setCompressorResolution(
46  const QSizeF& size,
47  const AbstractCoordinatePlane* plane )
48 {
49  compressor.setResolution( static_cast<int>( size.width() * plane->zoomFactorX() ),
50  static_cast<int>( size.height() * plane->zoomFactorY() ) );
51 }
52 
53 void Plotter::Private::changedProperties()
54 {
55  if ( CartesianCoordinatePlane* plane = dynamic_cast< CartesianCoordinatePlane* > ( diagram->coordinatePlane() ) )
56  {
57  QPair< qreal, qreal > verticalRange = plane->verticalRange();
58  if ( verticalRange.first != verticalRange.second )
59  implementor->plotterCompressor().setForcedDataBoundaries( verticalRange, Qt::Vertical );
60  QPair< qreal, qreal > horizontalRange = plane->horizontalRange();
61  if ( verticalRange.first != horizontalRange.second )
62  implementor->plotterCompressor().setForcedDataBoundaries( horizontalRange, Qt::Horizontal );
63  }
64 }
65 
66 AttributesModel* Plotter::PlotterType::attributesModel() const
67 {
68  return m_private->attributesModel;
69 }
70 
71 ReverseMapper& Plotter::PlotterType::reverseMapper()
72 {
73  return m_private->reverseMapper;
74 }
75 
76 Plotter* Plotter::PlotterType::diagram() const
77 {
78  return static_cast< Plotter* >( m_private->diagram );
79 }
80 
81 CartesianDiagramDataCompressor& Plotter::PlotterType::compressor() const
82 {
83  return m_private->compressor;
84 }
85 
86 PlotterDiagramCompressor& Plotter::PlotterType::plotterCompressor() const
87 {
88  return m_private->plotterCompressor;
89 }
90 
91 Plotter::CompressionMode Plotter::PlotterType::useCompression() const
92 {
93  return m_private->useCompression;
94 }
95 
96 void Plotter::PlotterType::setUseCompression( Plotter::CompressionMode value )
97 {
98  m_private->useCompression = value;
99 }

Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.com/
http://www.kdab.com/products/kd-chart/