##// END OF EJS Templates
Simple to examples
Simple to examples

File last commit:

r1426:9cc71c12c6d0
r1623:484828e48d5e
Show More
chartanimator.cpp
168 lines | 5.1 KiB | text/x-c | CppLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
**
** Copyright (C) 2012 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the Qt Commercial Charts Add-on.
**
** $QT_BEGIN_LICENSE$
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
** $QT_END_LICENSE$
**
****************************************************************************/
Michal Klocek
Animation refactor...
r530 #include "chartanimator_p.h"
#include "axisanimation_p.h"
#include "xyanimation_p.h"
Michal Klocek
Improves spline interpolation...
r622 #include "splineanimation_p.h"
Michal Klocek
Refactor xychartitem -> xychart
r1218 #include "xychart_p.h"
Jani Honkonen
Add animations to pie. Works but has some visual issues when adding slices.
r618 #include "pieanimation_p.h"
sauimone
Animation framework for barchart.
r671 #include "baranimation_p.h"
#include "barchartitem_p.h"
sauimone
animations for stacked and percentbarchart
r1426 #include "stackedbaranimation_p.h"
#include "stackedbarchartitem_p.h"
#include "percentbaranimation_p.h"
#include "percentbarchartitem_p.h"
Michal Klocek
Adds area chart animations...
r560 #include "areachartitem_p.h"
Michal Klocek
Improves spline interpolation...
r622 #include "splinechartitem_p.h"
#include "scatterchartitem_p.h"
Michal Klocek
Refactors axis animation, line animations
r1241 #include "chartaxis_p.h"
Michal Klocek
Animation refactor...
r530 #include <QTimer>
Q_DECLARE_METATYPE(QVector<QPointF>)
Q_DECLARE_METATYPE(QVector<qreal>)
sauimone
barchart animation mechanics working. still some todo
r681 Q_DECLARE_METATYPE(QVector<QRectF>)
Michal Klocek
Animation refactor...
r530
QTCOMMERCIALCHART_BEGIN_NAMESPACE
Michal Klocek
Refactors axis animation, line animations
r1241 ChartAnimator::ChartAnimator(QObject *parent):QObject(parent)
Michal Klocek
Animation refactor...
r530 {
}
ChartAnimator::~ChartAnimator()
{
}
Marek Rosa
Animation folder formating: white spaces, brackets, etc fixed
r738 void ChartAnimator::addAnimation(PieChartItem *item)
Jani Honkonen
Add animations to pie. Works but has some visual issues when adding slices.
r618 {
Marek Rosa
Animation folder formating: white spaces, brackets, etc fixed
r738 ChartAnimation *animation = m_animations.value(item);
Jani Honkonen
Add animations to pie. Works but has some visual issues when adding slices.
r618
Marek Rosa
Animation folder formating: white spaces, brackets, etc fixed
r738 if (!animation) {
Jani Honkonen
Add animations to pie. Works but has some visual issues when adding slices.
r618 animation = new PieAnimation(item);
Marek Rosa
Animation folder formating: white spaces, brackets, etc fixed
r738 m_animations.insert(item, animation);
Jani Honkonen
Add animations to pie. Works but has some visual issues when adding slices.
r618 }
item->setAnimator(this);
}
Marek Rosa
Animation folder formating: white spaces, brackets, etc fixed
r738 void ChartAnimator::addAnimation(BarChartItem *item)
sauimone
Animation framework for barchart.
r671 {
sauimone
animations for stacked and percentbarchart
r1426 // This can handle also GroupedBarChartItem because bars are side by side
Marek Rosa
Animation folder formating: white spaces, brackets, etc fixed
r738 ChartAnimation *animation = m_animations.value(item);
sauimone
Animation framework for barchart.
r671
Marek Rosa
Animation folder formating: white spaces, brackets, etc fixed
r738 if (!animation) {
sauimone
Animation framework for barchart.
r671 animation = new BarAnimation(item);
Marek Rosa
Animation folder formating: white spaces, brackets, etc fixed
r738 m_animations.insert(item, animation);
sauimone
Animation framework for barchart.
r671 }
item->setAnimator(this);
}
sauimone
animations for stacked and percentbarchart
r1426 void ChartAnimator::addAnimation(StackedBarChartItem *item)
{
ChartAnimation *animation = m_animations.value(item);
if (!animation) {
animation = new StackedBarAnimation(item);
m_animations.insert(item, animation);
}
item->setAnimator(this);
}
void ChartAnimator::addAnimation(PercentBarChartItem *item)
{
ChartAnimation *animation = m_animations.value(item);
if (!animation) {
animation = new PercentBarAnimation(item);
m_animations.insert(item, animation);
}
item->setAnimator(this);
}
sauimone
Animation framework for barchart.
r671
Marek Rosa
Animation folder formating: white spaces, brackets, etc fixed
r738 void ChartAnimator::removeAnimation(Chart *item)
Michal Klocek
Animation refactor...
r530 {
item->setAnimator(0);
m_animations.remove(item);
}
Jani Honkonen
Refactor graphical side of pie to simplify the implementation.
r1074 void ChartAnimator::addAnimation(PieChartItem *item, PieSliceItem *sliceItem, const PieSliceData &sliceData, bool startupAnimation)
Jani Honkonen
Add animations to pie. Works but has some visual issues when adding slices.
r618 {
Marek Rosa
Animation folder formating: white spaces, brackets, etc fixed
r738 PieAnimation *animation = static_cast<PieAnimation *>(m_animations.value(item));
Jani Honkonen
Add animations to pie. Works but has some visual issues when adding slices.
r618 Q_ASSERT(animation);
Jani Honkonen
Refactor graphical side of pie to simplify the implementation.
r1074 animation->addSlice(sliceItem, sliceData, startupAnimation);
Jani Honkonen
Refactoring pie series and animations.
r621 }
Jani Honkonen
Refactor piechart to avoid using invalid QPieSlice pointers....
r1053 void ChartAnimator::removeAnimation(PieChartItem *item, PieSliceItem *sliceItem)
Jani Honkonen
Refactoring pie series and animations.
r621 {
Marek Rosa
Animation folder formating: white spaces, brackets, etc fixed
r738 PieAnimation *animation = static_cast<PieAnimation *>(m_animations.value(item));
Jani Honkonen
Refactoring pie series and animations.
r621 Q_ASSERT(animation);
Jani Honkonen
Refactor piechart to avoid using invalid QPieSlice pointers....
r1053 animation->removeSlice(sliceItem);
Jani Honkonen
Refactoring pie series and animations.
r621 }
Jani Honkonen
Refactor graphical side of pie to simplify the implementation.
r1074 void ChartAnimator::updateAnimation(PieChartItem *item, PieSliceItem *sliceItem, const PieSliceData &sliceData)
Jani Honkonen
Add animations to pie. Works but has some visual issues when adding slices.
r618 {
Marek Rosa
Animation folder formating: white spaces, brackets, etc fixed
r738 PieAnimation *animation = static_cast<PieAnimation *>(m_animations.value(item));
Jani Honkonen
Add animations to pie. Works but has some visual issues when adding slices.
r618 Q_ASSERT(animation);
Jani Honkonen
Refactor piechart to avoid using invalid QPieSlice pointers....
r1053 animation->updateValue(sliceItem, sliceData);
Jani Honkonen
Add animations to pie. Works but has some visual issues when adding slices.
r618 }
Marek Rosa
Animation folder formating: white spaces, brackets, etc fixed
r738 void ChartAnimator::updateLayout(BarChartItem *item, const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout)
sauimone
Animation framework for barchart.
r671 {
Marek Rosa
Animation folder formating: white spaces, brackets, etc fixed
r738 BarAnimation *animation = static_cast<BarAnimation *>(m_animations.value(item));
Marek Rosa
Fix to BarSeries animation on BarSets restructured
r1418 if (animation) {
sauimone
animations for stacked and percentbarchart
r1426 m_animations.remove(item);
Marek Rosa
Fix to BarSeries animation on BarSets restructured
r1418 animation->deleteLater();
animation = 0;
sauimone
animations for stacked and percentbarchart
r1426 addAnimation(item);
Marek Rosa
Fix to BarSeries animation on BarSets restructured
r1418 }
animation = static_cast<BarAnimation *>(m_animations.value(item));
sauimone
animations for stacked and percentbarchart
r1426 animation->updateLayout(oldLayout,newLayout);
}
void ChartAnimator::updateLayout(StackedBarChartItem *item, const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout)
{
StackedBarAnimation *animation = static_cast<StackedBarAnimation *>(m_animations.value(item));
if (animation) {
m_animations.remove(item);
animation->deleteLater();
animation = 0;
addAnimation(item);
}
animation = static_cast<StackedBarAnimation *>(m_animations.value(item));
animation->updateLayout(oldLayout,newLayout);
sauimone
Animation framework for barchart.
r671 }
sauimone
animations for stacked and percentbarchart
r1426 void ChartAnimator::updateLayout(PercentBarChartItem *item, const QVector<QRectF> &oldLayout, const QVector<QRectF> &newLayout)
{
PercentBarAnimation *animation = static_cast<PercentBarAnimation *>(m_animations.value(item));
if (animation) {
m_animations.remove(item);
animation->deleteLater();
animation = 0;
addAnimation(item);
}
animation = static_cast<PercentBarAnimation *>(m_animations.value(item));
animation->updateLayout(oldLayout,newLayout);
}
Michal Klocek
Krazy reported errors...
r974 #include "moc_chartanimator_p.cpp"
Michal Klocek
Animation refactor...
r530 QTCOMMERCIALCHART_END_NAMESPACE