19 #include <tulip/ForEach.h>
21 template<
typename PropType,
typename NodeType,
typename EdgeType>
22 PropertyAnimation<PropType, NodeType, EdgeType>::PropertyAnimation(
tlp::Graph *graph, PropType *start, PropType *end, PropType *out,
23 tlp::BooleanProperty *selection,
int frameCount,
bool computeNodes,
bool computeEdges, QObject* parent) :
25 Animation(frameCount,parent), _graph(graph), _start(0), _end(0), _out(out), _computeNodes(computeNodes), _computeEdges(computeEdges) {
30 assert(end->getGraph()->getRoot() == start->getGraph()->getRoot());
31 assert(end->getGraph()->getRoot() == out->getGraph()->getRoot());
33 assert(frameCount > 0);
35 this->_start =
new PropType(start->getGraph());
36 *(this->_start) = *start;
37 this->_end =
new PropType(end->getGraph());
42 this->_selection->setAllNodeValue(
true);
43 this->_selection->setAllEdgeValue(
true);
47 *(this->_selection) = *selection;
51 template<
typename PropType,
typename NodeType,
typename EdgeType>
52 PropertyAnimation<PropType, NodeType, EdgeType>::~PropertyAnimation() {
58 template<
typename PropType,
typename NodeType,
typename EdgeType>
59 void PropertyAnimation<PropType, NodeType, EdgeType>::frameChanged(
int f) {
62 forEach(n, _graph->getNodes()) {
63 if (_selection->getNodeValue(n))
64 _out->setNodeValue(n, getNodeFrameValue(_start->getNodeValue(n), _end->getNodeValue(n), f));
70 forEach(e, _graph->getEdges()) {
71 if (_selection->getEdgeValue(e))
72 _out->setEdgeValue(e, getEdgeFrameValue(_start->getEdgeValue(e), _end->getEdgeValue(e), f));