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;
47 static const std::string propertyTypename;
48 const std::string& getTypename()
const {
49 return propertyTypename;
52 virtual void setNodeValue(
const node n,
53 tlp::StoredType<double>::ReturnedConstValue v);
54 virtual void setEdgeValue(
const edge e,
55 tlp::StoredType<double>::ReturnedConstValue v);
56 virtual void setAllNodeValue(tlp::StoredType<double>::ReturnedConstValue v);
58 virtual void setValueToGraphNodes(tlp::StoredType<double>::ReturnedConstValue v,
const Graph* graph);
59 virtual void setAllEdgeValue(tlp::StoredType<double>::ReturnedConstValue v);
60 virtual void setValueToGraphEdges(tlp::StoredType<double>::ReturnedConstValue v,
const Graph *graph);
62 enum PredefinedMetaValueCalculator {NO_CALC = 0, AVG_CALC = 1, SUM_CALC = 2,
63 MAX_CALC = 3, MIN_CALC = 4
68 void setMetaValueCalculator(PredefinedMetaValueCalculator nodeCalc = AVG_CALC,
69 PredefinedMetaValueCalculator edgeCalc = AVG_CALC);
72 virtual double getNodeDoubleValue(
const node n)
const {
73 return getNodeValue(n);
75 virtual double getNodeDoubleDefaultValue()
const {
76 return getNodeDefaultValue();
78 virtual double getNodeDoubleMin(
const Graph* g = NULL) {
81 virtual double getNodeDoubleMax(
const Graph* g = NULL) {
84 virtual double getEdgeDoubleValue(
const edge e)
const {
85 return getEdgeValue(e);
87 virtual double getEdgeDoubleDefaultValue()
const {
88 return getEdgeDefaultValue();
90 virtual double getEdgeDoubleMin(
const Graph* g = NULL) {
93 virtual double getEdgeDoubleMax(
const Graph* g = NULL) {
97 void nodesUniformQuantification(
unsigned int);
99 void edgesUniformQuantification(
unsigned int);
108 _DEPRECATED
virtual void setAllEdgeValue(tlp::StoredType<double>::ReturnedConstValue v,
const Graph *graph);
109 _DEPRECATED
virtual void setAllNodeValue(tlp::StoredType<double>::ReturnedConstValue v,
const Graph* graph);
113 void treatEvent(
const Event&);
124 DoubleVectorProperty(
Graph *g,
const std::string& n=
""):AbstractVectorProperty<DoubleVectorType, tlp::DoubleType>(g, n) {}
127 static const std::string propertyTypename;
128 const std::string& getTypename()
const {
129 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.