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