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;
47 static const std::string propertyTypename;
48 const std::string &getTypename()
const override {
49 return propertyTypename;
52 void setNodeValue(
const node n, tlp::StoredType<double>::ReturnedConstValue v)
override;
53 void setEdgeValue(
const edge e, tlp::StoredType<double>::ReturnedConstValue v)
override;
54 void setAllNodeValue(tlp::StoredType<double>::ReturnedConstValue v)
override;
56 void setValueToGraphNodes(tlp::StoredType<double>::ReturnedConstValue v,
57 const Graph *graph)
override;
58 void setAllEdgeValue(tlp::StoredType<double>::ReturnedConstValue v)
override;
59 void setValueToGraphEdges(tlp::StoredType<double>::ReturnedConstValue v,
60 const Graph *graph)
override;
62 enum PredefinedMetaValueCalculator {
72 void setMetaValueCalculator(PredefinedMetaValueCalculator nodeCalc = AVG_CALC,
73 PredefinedMetaValueCalculator edgeCalc = AVG_CALC);
76 double getNodeDoubleValue(
const node n)
const override {
77 return getNodeValue(n);
79 double getNodeDoubleDefaultValue()
const override {
80 return getNodeDefaultValue();
82 double getNodeDoubleMin(
const Graph *g =
nullptr)
override {
85 double getNodeDoubleMax(
const Graph *g =
nullptr)
override {
88 double getEdgeDoubleValue(
const edge e)
const override {
89 return getEdgeValue(e);
91 double getEdgeDoubleDefaultValue()
const override {
92 return getEdgeDefaultValue();
94 double getEdgeDoubleMin(
const Graph *g =
nullptr)
override {
97 double getEdgeDoubleMax(
const Graph *g =
nullptr)
override {
101 void nodesUniformQuantification(
unsigned int)
override;
103 void edgesUniformQuantification(
unsigned int)
override;
112 _DEPRECATED
void setAllEdgeValue(tlp::StoredType<double>::ReturnedConstValue v,
113 const Graph *graph)
override;
114 _DEPRECATED
void setAllNodeValue(tlp::StoredType<double>::ReturnedConstValue v,
115 const Graph *graph)
override;
119 void treatEvent(
const Event &)
override;
128 :
public AbstractVectorProperty<tlp::DoubleVectorType, tlp::DoubleType> {
131 : AbstractVectorProperty<DoubleVectorType, tlp::DoubleType>(g, n) {}
134 static const std::string propertyTypename;
135 const std::string &getTypename()
const override {
136 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.