Tulip  4.2.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
BooleanProperty.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
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, std::string n="") :AbstractProperty<BooleanType,BooleanType>(g, n) {}
38  // PropertyInterface inherited methods
39  PropertyInterface* clonePrototype(Graph *, const std::string&);
40  static const std::string propertyTypename;
41  std::string getTypename() const {
42  return propertyTypename;
43  }
44 
45  /**
46  * Reverses all values associated to graph elements,
47  * i.e true => false, false => true.
48  */
49  void reverse();
50 
51  /**
52  * Reverses all the direction of edges of the visible graph
53  * which are true in this BooleanProperty.
54  */
55  void reverseEdgeDirection();
56 
57  /**
58  * Returns an iterator through all nodes belonging to g
59  * whose associated value is equal to val.
60  * If g is NULL, the graph given when creating the property is considered.
61  */
62  Iterator<node> *getNodesEqualTo(const bool val, Graph *g = NULL);
63 
64  /**
65  * Returns an iterator through all edges belonging to g
66  * whose associated value is equal to val.
67  * If g is NULL, the graph given when creating the property is considered.
68  */
69  Iterator<edge> *getEdgesEqualTo(const bool val, Graph *g = NULL);
70 };
71 
72 /**
73  * @ingroup Graph
74  * @brief A graph property that maps a std::vector<bool> value to graph elements.
75  */
76 class TLP_SCOPE BooleanVectorProperty:public AbstractVectorProperty<tlp::BooleanVectorType, tlp::BooleanType> {
77 public :
78  BooleanVectorProperty(Graph *g, std::string n="") :AbstractVectorProperty<BooleanVectorType, tlp::BooleanType>(g, n) {}
79  // PropertyInterface inherited methods
80  PropertyInterface* clonePrototype(Graph *, const std::string&);
81  static const std::string propertyTypename;
82  std::string getTypename() const {
83  return propertyTypename;
84  }
85 
86 };
87 
88 }
89 
90 #endif