1 /*
2  * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB.  All rights reserved.
3  *
4  * This file is part of the KD Chart library.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef ZOOMPARAMETERS_H
21 #define ZOOMPARAMETERS_H
22 
23 //
24 //  W A R N I N G
25 //  -------------
26 //
27 // This file is not part of the KD Chart API.  It exists purely as an
28 // implementation detail.  This header file may change from version to
29 // version without notice, or even be removed.
30 //
31 // We mean it.
32 //
33 
34 namespace KChart {
35     /**
36       * ZoomParameters stores the center and the factor of zooming internally
37       * \internal
38       */
39     class ZoomParameters {
40     public:
ZoomParameters()41         ZoomParameters()
42         : xFactor( 1.0 ),
43           yFactor( 1.0 ),
44           xCenter( 0.5 ),
45           yCenter( 0.5)
46         {
47         }
48 
ZoomParameters(qreal xFactor,qreal yFactor,const QPointF & center)49         ZoomParameters( qreal xFactor, qreal yFactor, const QPointF& center )
50         : xFactor( xFactor ),
51           yFactor( yFactor ),
52           xCenter( center.x() ),
53           yCenter( center.y() )
54         {
55         }
56 
setCenter(const QPointF & center)57         void setCenter( const QPointF& center )
58         {
59             xCenter = center.x();
60             yCenter = center.y();
61         }
center()62         const QPointF center() const
63         {
64             return QPointF( xCenter, yCenter );
65         }
66 
67         qreal xFactor;
68         qreal yFactor;
69 
70         qreal xCenter;
71         qreal yCenter;
72     };
73 }
74 
75 #endif
76