Tulip  5.7.4
Large graphs analysis and drawing
ColorProperty.h
1 /*
2  *
3  * This file is part of Tulip (https://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_COLORS_H
21 #define TULIP_COLORS_H
22 
23 #include <tulip/PropertyTypes.h>
24 #include <tulip/AbstractProperty.h>
25 
26 namespace tlp {
27 
28 class PropertyContext;
29 
30 typedef AbstractProperty<tlp::ColorType, tlp::ColorType> AbstractColorProperty;
31 
32 /**
33  * @ingroup Graph
34  * @brief A graph property that maps a tlp::Color value to graph elements.
35  */
36 class TLP_SCOPE ColorProperty : public AbstractColorProperty {
37 public:
38  ColorProperty(Graph *g, const std::string &n = "");
39  using AbstractColorProperty::operator=;
40  // PropertyInterface inherited methods
41  PropertyInterface *clonePrototype(Graph *, const std::string &) const override;
42  static const std::string propertyTypename;
43  const std::string &getTypename() const override {
44  return propertyTypename;
45  }
46  DEFINE_GET_CPP_CLASS_NAME;
47 
48  int compare(const node n1, const node n2) const override;
49  int compare(const edge e1, const edge e2) const override;
50 };
51 
52 /**
53  * @ingroup Graph
54  * @brief A graph property that maps a std::vector<tlp::Color> value to graph elements.
55  */
56 class TLP_SCOPE ColorVectorProperty
57  : public AbstractVectorProperty<tlp::ColorVectorType, tlp::ColorType> {
58 public:
59  ColorVectorProperty(Graph *g, const std::string &n = "")
60  : AbstractVectorProperty<ColorVectorType, tlp::ColorType>(g, n) {}
61  using AbstractVectorProperty<tlp::ColorVectorType, tlp::ColorType>::operator=;
62  // PropertyInterface inherited methods
63  PropertyInterface *clonePrototype(Graph *, const std::string &) const override;
64  static const std::string propertyTypename;
65  const std::string &getTypename() const override {
66  return propertyTypename;
67  }
68  DEFINE_GET_CPP_CLASS_NAME;
69 };
70 } // namespace tlp
71 #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 tlp::Color value to graph elements.
Definition: ColorProperty.h:36
const std::string & getTypename() const override
Gets a string describing the type of the property value (e.g. "graph", "double", "layout",...
Definition: ColorProperty.h:43
int compare(const node n1, const node n2) const override
Compares the value this property holds for the two given nodes.
int compare(const edge e1, const edge e2) const override
Compares the value this property holds for the two given edges.
PropertyInterface * clonePrototype(Graph *, const std::string &) const override
Creates a property of the same type (e.g. tlp::DoubleProperty) in the graph. The new property will no...
A graph property that maps a std::vector<tlp::Color> value to graph elements.
Definition: ColorProperty.h:57
const std::string & getTypename() const override
Gets a string describing the type of the property value (e.g. "graph", "double", "layout",...
Definition: ColorProperty.h:65
PropertyInterface * clonePrototype(Graph *, const std::string &) const override
Creates a property of the same type (e.g. tlp::DoubleProperty) in the graph. The new property will no...
PropertyInterface describes the interface of a graph property.
The edge struct represents an edge in a Graph object.
Definition: Edge.h:40
The node struct represents a node in a Graph object.
Definition: Node.h:40