|
Tulip
5.6.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)>
31 #define NODE_VALUE typename nodeType::RealType
32 #define CONST_NODE_VALUE typename tlp::StoredType<typename nodeType::RealType>::ReturnedConstValue
33 #define EDGE_VALUE typename edgeType::RealType
34 #define CONST_EDGE_VALUE typename tlp::StoredType<typename edgeType::RealType>::ReturnedConstValue
45 template <
typename nodeType,
typename edgeType,
typename propType = PropertyInterface>
48 const MINMAX_PAIR(nodeType) & getNodeMinMax(
const Graph *graph =
nullptr);
49 const MINMAX_PAIR(edgeType) & getEdgeMinMax(
const Graph *graph =
nullptr);
63 EDGE_VALUE EdgeMin, EDGE_VALUE EdgeMax);
76 return getNodeMinMax(graph).first;
88 return getNodeMinMax(graph).second;
100 return getEdgeMinMax(graph).first;
112 return getEdgeMinMax(graph).second;
151 MINMAX_MAP(nodeType) minMaxNode;
152 MINMAX_MAP(edgeType) minMaxEdge;
160 bool needGraphListener;
162 const MINMAX_PAIR(nodeType) & computeMinMaxNode(
const Graph *graph);
163 const MINMAX_PAIR(edgeType) & computeMinMaxEdge(
const Graph *graph);
164 void removeListenersAndClearNodeMap();
165 void removeListenersAndClearEdgeMap();
169 #include "cxx/minmaxproperty.cxx"
171 #endif // MINMAXPROPERTY_H
CONST_EDGE_VALUE getEdgeMin(const Graph *graph=nullptr)
Computes the minimum value on the edges. It is only computed if it has never been retrieved before,...
CONST_EDGE_VALUE getEdgeMax(const Graph *graph=nullptr)
Computes the maximum value on the edges. It is only computed if it has never been retrieved before,...
MinMaxProperty(tlp::Graph *graph, const std::string &name, NODE_VALUE NodeMin, NODE_VALUE NodeMax, EDGE_VALUE EdgeMin, EDGE_VALUE EdgeMax)
Constructs a MinMaxProperty.
void updateAllEdgesValues(CONST_EDGE_VALUE newValue)
Updates the value of all edges, setting the maximum and minimum values to this. Should be called by s...
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, CONST_EDGE_VALUE newValue)
Updates the value on an edge, and updates the minimal/maximal cached values if necessary....
void updateAllNodesValues(CONST_NODE_VALUE newValue)
Updates the value of all nodes, setting the maximum and minimum values to this. Should be called by s...
CONST_NODE_VALUE getNodeMax(const Graph *graph=nullptr)
Computes the maximum value on the nodes. It is only computed if it has never been retrieved before,...
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.
CONST_NODE_VALUE getNodeMin(const Graph *graph=nullptr)
Gets the minimum value on the nodes. It is only computed if it has never been retrieved before,...
void updateNodeValue(tlp::node n, CONST_NODE_VALUE newValue)
Updates the value on a node, and updates the minimal/maximal cached values if necessary....
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.