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;
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 {
72 void setMetaValueCalculator(PropertyInterface::MetaValueCalculator *calc)
override;
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) {}
130 static const std::string propertyTypename;
132 return propertyTypename;
134 DEFINE_GET_CPP_CLASS_NAME;