 |
Tulip
5.5.0
Large graphs analysis and drawing
|
20 #ifndef MINMAXPROPERTY_H
21 #define MINMAXPROPERTY_H
23 #include <unordered_map>
25 #include <tulip/Observable.h>
26 #include <tulip/AbstractProperty.h>
28 #define MINMAX_PAIR(TYPE) std::pair<typename TYPE::RealType, typename TYPE::RealType>
29 #define MINMAX_MAP(TYPE) typename std::unordered_map<unsigned int, MINMAX_PAIR(TYPE)>
40 template <
typename nodeType,
typename edgeType,
typename propType = PropertyInterface>
54 typename nodeType::RealType NodeMax,
typename edgeType::RealType EdgeMin,
55 typename edgeType::RealType EdgeMax);
135 MINMAX_MAP(nodeType) minMaxNode;
136 MINMAX_MAP(edgeType) minMaxEdge;
138 typename nodeType::RealType _nodeMin;
139 typename nodeType::RealType _nodeMax;
140 typename edgeType::RealType _edgeMin;
141 typename edgeType::RealType _edgeMax;
144 bool needGraphListener;
146 MINMAX_PAIR(nodeType) computeMinMaxNode(
const Graph *graph);
147 MINMAX_PAIR(edgeType) computeMinMaxEdge(
const Graph *graph);
148 void removeListenersAndClearNodeMap();
149 void removeListenersAndClearEdgeMap();
153 #include "cxx/minmaxproperty.cxx"
155 #endif // MINMAXPROPERTY_H
void treatEvent(const tlp::Event &ev) override
This function is called when events are sent to the Listeners, and Listeners only.
void updateEdgeValue(tlp::edge e, typename edgeType::RealType newValue)
Updates the value on an edge, and updates the minimal/maximal cached values if necessary....
nodeType::RealType getNodeMax(const Graph *graph=nullptr)
Computes the maximum value on the nodes. It is only computed if it has never been retrieved before,...
void updateAllEdgesValues(typename edgeType::RealType newValue)
Updates the value of all edges, setting the maximum and minimum values to this. Should be called by s...
void updateAllNodesValues(typename nodeType::RealType newValue)
Updates the value of all nodes, setting the maximum and minimum values to this. Should be called by s...
This class extends upon PropertyInterface, and adds type-safe methods to get and set the node and edg...
Event is the base class for all events used in the Observation mechanism.
edgeType::RealType getEdgeMin(const Graph *graph=nullptr)
Computes the minimum value on the edges. It is only computed if it has never been retrieved before,...
void updateNodeValue(tlp::node n, typename nodeType::RealType newValue)
Updates the value on a node, and updates the minimal/maximal cached values if necessary....
nodeType::RealType getNodeMin(const Graph *graph=nullptr)
Gets the minimum value on the nodes. It is only computed if it has never been retrieved before,...
MinMaxProperty(tlp::Graph *graph, const std::string &name, typename nodeType::RealType NodeMin, typename nodeType::RealType NodeMax, typename edgeType::RealType EdgeMin, typename edgeType::RealType EdgeMax)
Constructs a MinMaxProperty.
edgeType::RealType getEdgeMax(const Graph *graph=nullptr)
Computes the maximum value on the edges. It is only computed if it has never been retrieved before,...
The edge struct represents an edge in a Graph object.
The node struct represents a node in a Graph object.
Abstracts the computation of minimal and maximal values on node and edge values of properties.