Tulip  5.1.0
Large graphs analysis and drawing
PropertyAnimation.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef PROPERTYANIMATION_H_
22 #define PROPERTYANIMATION_H_
23 
24 #include <tulip/Animation.h>
25 #include <tulip/BooleanProperty.h>
26 
27 
28 namespace tlp {
29 
30 template<typename PropType, typename NodeType, typename EdgeType>
31 class PropertyAnimation: public Animation {
32 public:
33  PropertyAnimation(tlp::Graph *graph, PropType *start, PropType *end, PropType *out,
34  tlp::BooleanProperty *selection = NULL, int frameCount = 1, bool computeNodes = true, bool computeEdges = true, QObject* parent=NULL);
35 
36  virtual ~PropertyAnimation();
37  virtual void frameChanged(int f);
38 
39 protected:
40  tlp::Graph *_graph;
41  PropType *_start;
42  PropType *_end;
43  PropType *_out;
44  tlp::BooleanProperty *_selection;
45  bool _computeNodes;
46  bool _computeEdges;
47 
48  virtual NodeType getNodeFrameValue(const NodeType &startValue, const NodeType &endValue, int frame)=0;
49  virtual EdgeType getEdgeFrameValue(const EdgeType &startValue, const EdgeType &endValue, int frame)=0;
50 
51  virtual bool equalNodes(const NodeType &v1, const NodeType &v2) {
52  return v1 == v2;
53  }
54 
55  virtual bool equalEdges(const EdgeType &v1, const EdgeType &v2) {
56  return v1 == v2;
57  }
58 };
59 
60 #include "cxx/PropertyAnimation.cxx"
61 
62 }
63 
64 #endif /* PROPERTYANIMATION_H_ */
65 ///@endcond
A graph property that maps a boolean value to graph elements.