Tulip  5.3.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 namespace tlp {
28 
29 template <typename PropType, typename NodeType, typename EdgeType>
30 class PropertyAnimation : public Animation {
31 public:
32  PropertyAnimation(tlp::Graph *graph, PropType *start, PropType *end, PropType *out,
33  tlp::BooleanProperty *selection = nullptr, int frameCount = 1,
34  bool computeNodes = true, bool computeEdges = true, QObject *parent = nullptr);
35 
36  ~PropertyAnimation() override;
37  void frameChanged(int f) override;
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,
49  int frame) = 0;
50  virtual EdgeType getEdgeFrameValue(const EdgeType &startValue, const EdgeType &endValue,
51  int frame) = 0;
52 
53  virtual bool equalNodes(const NodeType &v1, const NodeType &v2) {
54  return v1 == v2;
55  }
56 
57  virtual bool equalEdges(const EdgeType &v1, const EdgeType &v2) {
58  return v1 == v2;
59  }
60 };
61 
62 #include "cxx/PropertyAnimation.cxx"
63 } // namespace tlp
64 
65 #endif /* PROPERTYANIMATION_H_ */
66 ///@endcond
A graph property that maps a boolean value to graph elements.