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), _graph(graph), _start(nullptr), _end(nullptr), _out(out),
28 _computeNodes(computeNodes), _computeEdges(computeEdges) {
33 assert(end->getGraph()->getRoot() == start->getGraph()->getRoot());
34 assert(end->getGraph()->getRoot() == out->getGraph()->getRoot());
36 assert(frameCount > 0);
38 this->_start =
new PropType(start->getGraph());
39 *(this->_start) = *start;
40 this->_end =
new PropType(end->getGraph());
45 this->_selection->setAllNodeValue(
true);
46 this->_selection->setAllEdgeValue(
true);
49 *(this->_selection) = *selection;
53 template <
typename PropType,
typename NodeType,
typename EdgeType>
54 PropertyAnimation<PropType, NodeType, EdgeType>::~PropertyAnimation() {
60 template <
typename PropType,
typename NodeType,
typename EdgeType>
61 void PropertyAnimation<PropType, NodeType, EdgeType>::frameChanged(
int f) {
63 for (
auto n : _graph->nodes()) {
64 if (_selection->getNodeValue(n))
65 _out->
setNodeValue(n, getNodeFrameValue(_start->getNodeValue(n), _end->getNodeValue(n), f));
70 for (
auto e : _graph->edges()) {
71 if (_selection->getEdgeValue(e))
72 _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.