20 #ifndef TULIP_METRIC_H 21 #define TULIP_METRIC_H 23 #include <tulip/tuliphash.h> 24 #include <tulip/PropertyTypes.h> 25 #include <tulip/AbstractProperty.h> 26 #include <tulip/PropertyAlgorithm.h> 27 #include <tulip/minmaxproperty.h> 28 #include <tulip/NumericProperty.h> 32 class PropertyContext;
34 typedef MinMaxProperty<tlp::DoubleType, tlp::DoubleType, tlp::NumericProperty> DoubleMinMaxProperty;
48 static const std::string propertyTypename;
49 const std::string &getTypename()
const override {
50 return propertyTypename;
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 {
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;
113 _DEPRECATED
void setAllEdgeValue(tlp::StoredType<double>::ReturnedConstValue v,
114 const Graph *graph)
override;
115 _DEPRECATED
void setAllNodeValue(tlp::StoredType<double>::ReturnedConstValue v,
116 const Graph *graph)
override;
120 void treatEvent(
const Event &)
override;
129 :
public AbstractVectorProperty<tlp::DoubleVectorType, tlp::DoubleType> {
132 : AbstractVectorProperty<DoubleVectorType, tlp::DoubleType>(g, n) {}
135 static const std::string propertyTypename;
136 const std::string &getTypename()
const override {
137 return propertyTypename;
This class extends upon PropertyInterface, and adds type-safe methods to get and set the node and edg...
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.
A graph property that maps a double value to graph elements.
Event is the base class for all events used in the Observation mechanism.
Interface all numerical properties. Property values are always returned as double.
A graph property that maps a std::vector<double> value to graph elements.