20 template <
typename PropType,
typename NodeType,
typename EdgeType>
21 PropertyAnimation<PropType, NodeType, EdgeType>::PropertyAnimation(
22 tlp::Graph *graph, PropType *start, PropType *end, PropType *out,
27 Animation(frameCount, parent),
28 _graph(graph), _start(nullptr), _end(nullptr), _out(out), _computeNodes(computeNodes),
29 _computeEdges(computeEdges) {
34 assert(end->getGraph()->getRoot() == start->getGraph()->getRoot());
35 assert(end->getGraph()->getRoot() == out->getGraph()->getRoot());
37 assert(frameCount > 0);
39 this->_start =
new PropType(start->getGraph());
40 *(this->_start) = *start;
41 this->_end =
new PropType(end->getGraph());
46 this->_selection->setAllNodeValue(
true);
47 this->_selection->setAllEdgeValue(
true);
50 *(this->_selection) = *selection;
54 template <
typename PropType,
typename NodeType,
typename EdgeType>
55 PropertyAnimation<PropType, NodeType, EdgeType>::~PropertyAnimation() {
61 template <
typename PropType,
typename NodeType,
typename EdgeType>
62 void PropertyAnimation<PropType, NodeType, EdgeType>::frameChanged(
int f) {
64 for (
auto n : _graph->nodes()) {
65 if (_selection->getNodeValue(n))
66 _out->
setNodeValue(n, getNodeFrameValue(_start->getNodeValue(n), _end->getNodeValue(n), f));
71 for (
auto e : _graph->edges()) {
72 if (_selection->getEdgeValue(e))
73 _out->setEdgeValue(e, getEdgeFrameValue(_start->getEdgeValue(e), _end->getEdgeValue(e), f));
A graph property that maps a boolean value to graph elements.
virtual void setNodeValue(const node n, typename tlp::StoredType< typename Tnode::RealType >::ReturnedConstValue v)
Sets the value of a node and notify the observers of a modification.