20 #ifndef TULIP_METRIC_H
21 #define TULIP_METRIC_H
23 #include <tulip/PropertyTypes.h>
24 #include <tulip/AbstractProperty.h>
25 #include <tulip/PropertyAlgorithm.h>
26 #include <tulip/minmaxproperty.h>
27 #include <tulip/NumericProperty.h>
31 class PropertyContext;
33 typedef MinMaxProperty<tlp::DoubleType, tlp::DoubleType, tlp::NumericProperty> DoubleMinMaxProperty;
42 using DoubleMinMaxProperty::operator=;
47 static const std::string propertyTypename;
49 return propertyTypename;
51 DEFINE_GET_CPP_CLASS_NAME;
53 void setNodeValue(
const node n, tlp::StoredType<double>::ReturnedConstValue v)
override;
54 void setEdgeValue(
const edge e, tlp::StoredType<double>::ReturnedConstValue v)
override;
55 void setAllNodeValue(tlp::StoredType<double>::ReturnedConstValue v)
override;
57 void setValueToGraphNodes(tlp::StoredType<double>::ReturnedConstValue v,
58 const Graph *graph)
override;
59 void setAllEdgeValue(tlp::StoredType<double>::ReturnedConstValue v)
override;
60 void setValueToGraphEdges(tlp::StoredType<double>::ReturnedConstValue v,
61 const Graph *graph)
override;
63 enum PredefinedMetaValueCalculator :
unsigned int {
64 NO_CALC = StandardMetaValueCalculator::NO_CALC,
65 AVG_CALC = StandardMetaValueCalculator::AVG_CALC,
66 SUM_CALC = StandardMetaValueCalculator::SUM_CALC,
67 MAX_CALC = StandardMetaValueCalculator::MAX_CALC,
68 MIN_CALC = StandardMetaValueCalculator::MIN_CALC
73 void setMetaValueCalculator(PredefinedMetaValueCalculator nodeCalc = AVG_CALC,
74 PredefinedMetaValueCalculator edgeCalc = AVG_CALC);
77 double getNodeDoubleValue(
const node n)
const override {
78 return getNodeValue(n);
80 double getNodeDoubleDefaultValue()
const override {
81 return getNodeDefaultValue();
83 double getNodeDoubleMin(
const Graph *g =
nullptr)
override {
86 double getNodeDoubleMax(
const Graph *g =
nullptr)
override {
89 double getEdgeDoubleValue(
const edge e)
const override {
90 return getEdgeValue(e);
92 double getEdgeDoubleDefaultValue()
const override {
93 return getEdgeDefaultValue();
95 double getEdgeDoubleMin(
const Graph *g =
nullptr)
override {
98 double getEdgeDoubleMax(
const Graph *g =
nullptr)
override {
102 void nodesUniformQuantification(
unsigned int)
override;
104 void edgesUniformQuantification(
unsigned int)
override;
106 NumericProperty *copyProperty(Graph *g)
override {
107 DoubleProperty *newProp =
new DoubleProperty(g);
115 void treatEvent(
const Event &)
override;
124 :
public AbstractVectorProperty<tlp::DoubleVectorType, tlp::DoubleType> {
127 : AbstractVectorProperty<DoubleVectorType, tlp::DoubleType>(g, n) {}
129 using AbstractVectorProperty<tlp::DoubleVectorType, tlp::DoubleType>::operator=;
131 static const std::string propertyTypename;
133 return propertyTypename;
135 DEFINE_GET_CPP_CLASS_NAME;
This class extends upon PropertyInterface, and adds type-safe methods to get and set the node and edg...
A graph property that maps a double value to graph elements.
const std::string & getTypename() const override
Gets a string describing the type of the property value (e.g. "graph", "double", "layout",...
void setMetaValueCalculator(PropertyInterface::MetaValueCalculator *calc) override
Sets the Calculator for meta nodes and 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<double> value to graph elements.
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...
Abstracts the computation of minimal and maximal values on node and edge values of properties.
PropertyInterface describes the interface of a graph property.
The edge struct represents an edge in a Graph object.
The node struct represents a node in a Graph object.