Tulip  5.2.1
Large graphs analysis and drawing
BooleanProperty.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 
20 #ifndef TULIP_SELECTION_H
21 #define TULIP_SELECTION_H
22 
23 #include <tulip/PropertyTypes.h>
24 #include <tulip/AbstractProperty.h>
25 #include <tulip/PropertyAlgorithm.h>
26 
27 namespace tlp {
28 
29 class PropertyContext;
30 
31 /**
32  * @ingroup Graph
33  * @brief A graph property that maps a boolean value to graph elements.
34  */
35 class TLP_SCOPE BooleanProperty : public AbstractProperty<tlp::BooleanType, tlp::BooleanType> {
36 public:
37  BooleanProperty(Graph *g, const std::string &n = "")
39  // PropertyInterface inherited methods
40  PropertyInterface *clonePrototype(Graph *, const std::string &) const override;
41  static const std::string propertyTypename;
42  const std::string &getTypename() const override {
43  return propertyTypename;
44  }
45 
46  /**
47  * Reverses all values associated to graph elements,
48  * i.e true => false, false => true.
49  * If sg is nullptr, the graph given when creating the property is considered.
50  */
51  void reverse(const Graph *sg = nullptr);
52 
53  /**
54  * Reverses all the direction of edges of the visible graph
55  * which are true in this BooleanProperty.
56  * * If sg is nullptr, the graph given when creating the property is considered.
57  */
58  void reverseEdgeDirection(Graph *sg = nullptr);
59 };
60 
61 /**
62  * @ingroup Graph
63  * @brief A graph property that maps a std::vector<bool> value to graph elements.
64  */
65 class TLP_SCOPE BooleanVectorProperty
66  : public AbstractVectorProperty<tlp::BooleanVectorType, tlp::BooleanType> {
67 public:
68  BooleanVectorProperty(Graph *g, const std::string &n = "")
69  : AbstractVectorProperty<BooleanVectorType, tlp::BooleanType>(g, n) {}
70  // PropertyInterface inherited methods
71  PropertyInterface *clonePrototype(Graph *, const std::string &) const override;
72  static const std::string propertyTypename;
73  const std::string &getTypename() const override {
74  return propertyTypename;
75  }
76 };
77 } // namespace tlp
78 
79 #endif
This class extends upon PropertyInterface, and adds type-safe methods to get and set the node and edg...
A graph property that maps a boolean value to graph elements.
PropertyInterface describes the interface of a graph property.
const std::string & getTypename() const override
Gets a string describing the type of the property (e.g. "graph", "double", "layout", "string", "integer", "color", "size").
A graph property that maps a std::vector<bool> value to graph elements.