Tulip  5.0.0
Large graphs analysis and drawing
SizeProperty.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
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_SIZES_H
21 #define TULIP_SIZES_H
22 
23 #include <tulip/tuliphash.h>
24 #include <tulip/PropertyTypes.h>
25 #include <tulip/AbstractProperty.h>
26 #include <tulip/PropertyAlgorithm.h>
27 
28 namespace tlp {
29 
30 class PropertyContext;
31 
32 typedef AbstractProperty<tlp::SizeType, tlp::SizeType> AbstractSizeProperty;
33 
34 /**
35  * @ingroup Graph
36  * @brief A graph property that maps a tlp::Size value to graph elements.
37  */
38 class TLP_SCOPE SizeProperty:public AbstractSizeProperty {
39 
40 public :
41  SizeProperty (Graph *, const std::string& n="");
42 
43  Size getMax(const Graph *sg=NULL);
44  Size getMin(const Graph *sg=NULL);
45  void scale( const tlp::Vector<float,3>&, const Graph *sg=NULL );
46  void scale( const tlp::Vector<float,3>&, Iterator<node> *, Iterator<edge> *);
47 
48  // redefinition of some PropertyInterface methods
49  PropertyInterface* clonePrototype(Graph *, const std::string&) const;
50  static const std::string propertyTypename;
51  const std::string& getTypename() const {
52  return propertyTypename;
53  }
54 
55 
56  // redefinition of some AbstractProperty methods
57  virtual void setNodeValue(const node n, tlp::StoredType<Size>::ReturnedConstValue v);
58  virtual void setAllNodeValue(tlp::StoredType<Size>::ReturnedConstValue v);
59  virtual void setValueToGraphNodes(tlp::StoredType<Size>::ReturnedConstValue v, const Graph *graph );
60 
61  int compare(const node n1, const node n2)const;
62 
63  _DEPRECATED virtual void setAllNodeValue( tlp::StoredType<Size>::ReturnedConstValue v, const Graph *graph );
64 
65 protected:
66  void resetMinMax();
67 
68 private:
69  TLP_HASH_MAP<unsigned int, Size> max,min;
70  TLP_HASH_MAP<unsigned int, bool> minMaxOk;
71  void computeMinMax(const Graph * sg=NULL);
72 };
73 
74 /**
75  * @ingroup Graph
76  * @brief A graph property that maps a std::vector<tlp::Size> value to graph elements.
77  */
78 class TLP_SCOPE SizeVectorProperty:public AbstractVectorProperty<tlp::SizeVectorType, tlp::SizeType> {
79 public :
80  SizeVectorProperty(Graph *g, const std::string& n=""):AbstractVectorProperty<SizeVectorType, SizeType>(g, n) {}
81 
82  // redefinition of some PropertyInterface methods
83  PropertyInterface* clonePrototype(Graph *, const std::string&) const;
84  static const std::string propertyTypename;
85  const std::string& getTypename() const {
86  return propertyTypename;
87  }
88 
89 };
90 
91 
92 }
93 #endif
PropertyInterface describes the interface of a graph property.
The node struct represents a node in a Graph object.
Definition: Node.h:39
A graph property that maps a tlp::Size value to graph elements.
Definition: SizeProperty.h:38
A graph property that maps a std::vector<tlp::Size> value to graph elements.
Definition: SizeProperty.h:78