2 GNU GENERAL PUBLIC LICENSE
3 Version 3, 29 June 2007
5 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
11 The GNU General Public License is a free, copyleft license for
12 software and other kinds of works.
14 The licenses for most software and other practical works are designed
15 to take away your freedom to share and change the works. By contrast,
16 the GNU General Public License is intended to guarantee your freedom to
17 share and change all versions of a program--to make sure it remains free
18 software for all its users. We, the Free Software Foundation, use the
19 GNU General Public License for most of our software; it applies also to
20 any other work released this way by its authors. You can apply it to
23 When we speak of free software, we are referring to freedom, not
24 price. Our General Public Licenses are designed to make sure that you
25 have the freedom to distribute copies of free software (and charge for
26 them if you wish), that you receive source code or can get it if you
27 want it, that you can change the software or use pieces of it in new
28 free programs, and that you know you can do these things.
30 To protect your rights, we need to prevent others from denying you
31 these rights or asking you to surrender the rights. Therefore, you have
32 certain responsibilities if you distribute copies of the software, or if
33 you modify it: responsibilities to respect the freedom of others.
35 For example, if you distribute copies of such a program, whether
36 gratis or for a fee, you must pass on to the recipients the same
37 freedoms that you received. You must make sure that they, too, receive
38 or can get the source code. And you must show them these terms so they
41 Developers that use the GNU GPL protect your rights with two steps:
42 (1) assert copyright on the software, and (2) offer you this License
43 giving you legal permission to copy, distribute and/or modify it.
45 For the developers' and authors' protection, the GPL clearly explains
46 that there is no warranty for this free software. For both users' and
47 authors' sake, the GPL requires that modified versions be marked as
48 changed, so that their problems will not be attributed erroneously to
49 authors of previous versions.
51 Some devices are designed to deny users access to install or run
52 modified versions of the software inside them, although the manufacturer
53 can do so. This is fundamentally incompatible with the aim of
54 protecting users' freedom to change the software. The systematic
55 pattern of such abuse occurs in the area of products for individuals to
56 use, which is precisely where it is most unacceptable. Therefore, we
57 have designed this version of the GPL to prohibit the practice for those
58 products. If such problems arise substantially in other domains, we
59 stand ready to extend this provision to those domains in future versions
60 of the GPL, as needed to protect the freedom of users.
62 Finally, every program is threatened constantly by software patents.
63 States should not allow patents to restrict development and use of
64 software on general-purpose computers, but in those that do, we wish to
65 avoid the special danger that patents applied to a free program could
66 make it effectively proprietary. To prevent this, the GPL assures that
67 patents cannot be used to render the program non-free.
69 The precise terms and conditions for copying, distribution and
72 http://www.gnu.org/licenses/gpl-3.0.txt
75 * @file ffchartscene.h
76 * @brief Contains a necessary class declaration.
78 * @author ComArch S.A.
83 #ifndef FFCHARTSCENE_H
84 #define FFCHARTSCENE_H
86 #include <QGraphicsScene>
87 #include <QGraphicsSceneMouseEvent>
88 #include <QGraphicsSceneDragDropEvent>
89 #include <QGraphicsLineItem>
93 #include <QApplication>
94 #include <QStyleOptionGraphicsItem>
97 #include <QGraphicsPathItem>
100 #include "ffchartseries.h"
101 #include "ffchartbutton.h"
102 #include "ffabstractwidget.h"
103 #include <QGraphicsEllipseItem>
105 * @author ComArch S.A.
109 * @brief Reimplemented a QGraphicsScene class. It is used by the FFChart class
113 class FFChartScene : public QGraphicsScene
117 FFChartScene(QObject* parent = 0);
118 virtual ~FFChartScene();
120 void moveTo(QPoint point);
121 void moveTo(float x, float y);
122 void moveBy(QPoint destPoint);
123 void moveBy(float x, float y);
125 void addSeries(FFChartSeries* series);
126 void setSeries(QList<FFChartSeries*> series);
128 void setSceneRect(const QRectF& rect);
130 void setSubaxesSpacing(const float& subaxesSpacing);
131 float subaxesSpacing() const;
133 void setSubaxesPen(const QPen& subaxesPen);
134 QPen subaxesPen() const;
136 void setAxesValuesPen(const QPen& axesValuesPen);
137 QPen axesValuesPen() const;
140 void seriesChanged(QList<FFChartSeries*> series);
141 void zoom(QRectF zoomRect);
142 void zoomIn(qreal ratio);
143 void zoomOut(qreal ratio);
146 void seriesChanged(QList<FFChartSeries*>*);
149 void drawItems(QPainter* painter,
151 QGraphicsItem* items[],
152 const QStyleOptionGraphicsItem options[],
154 void mousePressEvent(QGraphicsSceneMouseEvent* event);
155 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event);
156 void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
157 void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
160 QTimer* timer; ///< animation's timer
162 QTransform transform; ///< tool uses to transformations
164 float subaxesSpacing_; ///< spacing between suaxes
165 QPen subaxesPen_; ///< a pen of subaxes
166 QPen axesValuesPen_; ///< a pen of subaxes' values
168 QPointF translateFactor_; ///< new point of scene's top left corner
170 QSizeF accumulatedZoomFactor_; ///< accumulates factor of zooming
171 QPointF pressPos; ///< stores actual press position
172 QPointF oldPressPos;///< stores old press position
173 QPointF kineticVec; ///< stores kintetic vector
174 QPointF oldKineticVec; ///< stores old kinetic vector
176 QRectF itemsBoundingRect_; ///< bounding rectangle of items
178 QVector<float> itemsBoundingValues_; ///< stores items' bounding values
179 QRectF sceneRec; ///< stores scene's rectangle
181 QGraphicsRectItem* zoomRect; ///< stores pointer to zoom rectangle
183 FFChartButton zoomInButton; ///< button to zooming in
184 FFChartButton zoomOutButton; ///< button to zooming out
185 FFChartButton legendButton; ///< button to showing legend
186 QList<QGraphicsItem*> staticItems; ///< list of items on the scene
187 QList<FFChartSeries*> series; ///< list of series
189 bool zoomModeSw; ///< true if zooming mode is active
190 bool moveModeSw; ///< true if moving mode is active
191 bool kinetic; ///< true if kinetic is active
193 int kineticCount; ///< kinetic's counter
196 QRectF itemsBoundingRect(QVector<float>* boundaryValues = 0);
198 void drawAxes(QPainter* painter, QWidget* widget);
199 void drawSubAxes(QPainter* painter, QWidget* widget);
200 void drawSeries(QPainter* painter, QWidget* widget);
201 void drawStaticItems(QPainter* painter, QWidget* widget);
202 void drawValues(QPainter* painter, QWidget* widget);
205 void kineticScroll();
210 static const qreal kineticRatio = 1.5; ///< ratio of kinetic scolling
211 static const qreal defaultZoomInRatio = 0.2; ///< ratio of zoom in
212 static const qreal defaultZoomOutRatio = 1.0;///< ratio of zoom out
214 #endif // FFCHARTSCENE