20#ifndef PROPERTYALGORITHM_H
21#define PROPERTYALGORITHM_H
23#include <tulip/Algorithm.h>
24#include <tulip/Graph.h>
28static const std::string PROPERTY_ALGORITHM_CATEGORY =
"Property";
39 return PROPERTY_ALGORITHM_CATEGORY;
43template <
class Property>
44class TLP_SCOPE TypedPropertyAlgorithm :
public PropertyAlgorithm {
48 : PropertyAlgorithm(context), result(nullptr) {
49 if (dataSet !=
nullptr) {
50 if (!dataSet->exists(
"result")) {
51 std::string propname(
"result");
54 while (graph->existProperty(propname)) {
56 propname +=
"result" + std::to_string(number);
60 result = graph->getProperty<Property>(propname);
62 dataSet->get(
"result", result);
67 std::string category()
const override {
68 return PROPERTY_ALGORITHM_CATEGORY;
73static const std::string BOOLEAN_ALGORITHM_CATEGORY =
"Selection";
80class TLP_SCOPE BooleanAlgorithm :
public TypedPropertyAlgorithm<tlp::BooleanProperty> {
86 return BOOLEAN_ALGORITHM_CATEGORY;
91static const std::string COLOR_ALGORITHM_CATEGORY =
"Coloring";
97class TLP_SCOPE ColorAlgorithm :
public TypedPropertyAlgorithm<tlp::ColorProperty> {
103 return COLOR_ALGORITHM_CATEGORY;
108static const std::string DOUBLE_ALGORITHM_CATEGORY =
"Measure";
115class TLP_SCOPE DoubleAlgorithm :
public TypedPropertyAlgorithm<tlp::DoubleProperty> {
122 return DOUBLE_ALGORITHM_CATEGORY;
126class IntegerProperty;
127static const std::string INTEGER_ALGORITHM_CATEGORY =
"Measure";
134class TLP_SCOPE IntegerAlgorithm :
public TypedPropertyAlgorithm<tlp::IntegerProperty> {
140 return INTEGER_ALGORITHM_CATEGORY;
145static const std::string LAYOUT_ALGORITHM_CATEGORY =
"Layout";
152class TLP_SCOPE LayoutAlgorithm :
public TypedPropertyAlgorithm<tlp::LayoutProperty> {
159 return LAYOUT_ALGORITHM_CATEGORY;
164static const std::string SIZE_ALGORITHM_CATEGORY =
"Resizing";
170class TLP_SCOPE SizeAlgorithm :
public TypedPropertyAlgorithm<tlp::SizeProperty> {
176 return SIZE_ALGORITHM_CATEGORY;
181static const std::string STRING_ALGORITHM_CATEGORY =
"Labeling";
188class TLP_SCOPE StringAlgorithm :
public TypedPropertyAlgorithm<tlp::StringProperty> {
195 return STRING_ALGORITHM_CATEGORY;
This abstract class describes a basic algorithm plugin.
Algorithm(const PluginContext *context)
Constructs an algorithm and initializes members from the AlgorithmContext.
std::string category() const override
A string identifier for a plugin used for categorization purposes.
A graph property that maps a Boolean value to graph elements.
std::string category() const override
A string identifier for a plugin used for categorization purposes.
std::string category() const override
A string identifier for a plugin used for categorization purposes.
std::string category() const override
A string identifier for a plugin used for categorization purposes.
std::string category() const override
A string identifier for a plugin used for categorization purposes.
Contains runtime parameters for a plugin.
std::string category() const override
A string identifier for a plugin used for categorization purposes.
std::string category() const override
A string identifier for a plugin used for categorization purposes.
std::string category() const override
A string identifier for a plugin used for categorization purposes.