Tulip  4.6.0
Better Visualization Through Research
library/tulip-core/include/tulip/BooleanProperty.h
00001 /*
00002  *
00003  * This file is part of Tulip (www.tulip-software.org)
00004  *
00005  * Authors: David Auber and the Tulip development Team
00006  * from LaBRI, University of Bordeaux
00007  *
00008  * Tulip is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation, either version 3
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Tulip is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  *
00018  */
00019 
00020 #ifndef TULIP_SELECTION_H
00021 #define TULIP_SELECTION_H
00022 
00023 #include <tulip/PropertyTypes.h>
00024 #include <tulip/AbstractProperty.h>
00025 #include <tulip/PropertyAlgorithm.h>
00026 
00027 namespace tlp {
00028 
00029 class PropertyContext;
00030 
00031 /**
00032  * @ingroup Graph
00033  * @brief A graph property that maps a boolean value to graph elements.
00034  */
00035 class TLP_SCOPE BooleanProperty:public AbstractProperty<tlp::BooleanType, tlp::BooleanType> {
00036 public :
00037   BooleanProperty (Graph *g, const std::string& n="") :AbstractProperty<BooleanType,BooleanType>(g, n) {}
00038   // PropertyInterface inherited methods
00039   PropertyInterface* clonePrototype(Graph *, const std::string&);
00040   static const std::string propertyTypename;
00041   const std::string& getTypename() const {
00042     return propertyTypename;
00043   }
00044 
00045   /**
00046    * Reverses all values associated to graph elements,
00047    * i.e true => false, false => true.
00048    */
00049   void reverse();
00050 
00051   /**
00052    * Reverses all the direction of edges of the visible graph
00053    * which are true in this BooleanProperty.
00054    */
00055   void reverseEdgeDirection();
00056 
00057   /**
00058    * Returns an iterator through all nodes belonging to g
00059    * whose associated value is equal to val.
00060    * If g is NULL, the graph given when creating the property is considered.
00061    */
00062   Iterator<node> *getNodesEqualTo(const bool val, Graph *g = NULL);
00063 
00064   /**
00065    * Returns an iterator through all edges belonging to g
00066    * whose associated value is equal to val.
00067    * If g is NULL, the graph given when creating the property is considered.
00068    */
00069   Iterator<edge> *getEdgesEqualTo(const bool val, Graph *g = NULL);
00070 };
00071 
00072 /**
00073  * @ingroup Graph
00074  * @brief A graph property that maps a std::vector<bool> value to graph elements.
00075  */
00076 class TLP_SCOPE BooleanVectorProperty:public AbstractVectorProperty<tlp::BooleanVectorType, tlp::BooleanType> {
00077 public :
00078   BooleanVectorProperty(Graph *g, const std::string& n="") :AbstractVectorProperty<BooleanVectorType, tlp::BooleanType>(g, n) {}
00079   // PropertyInterface inherited methods
00080   PropertyInterface* clonePrototype(Graph *, const std::string&);
00081   static const std::string propertyTypename;
00082   const std::string& getTypename() const {
00083     return propertyTypename;
00084   }
00085 
00086 };
00087 
00088 }
00089 
00090 #endif
 All Classes Files Functions Variables Enumerations Enumerator Properties