6 #include "all_include.h"
9 ///Class MapStorage is responsible for storing
10 ///NodeMaps and EdgeMaps that can be shown later
11 ///on GUI. Therefore maps can be added to it,
12 ///and datas over the added maps can be queried.
13 ///The maps will be stored in an std::map,
14 ///referenced with their names. Unfortunately at
15 ///the moment it works only with double type maps
17 ///\todo too many things are public!!
23 XYMap<Graph::NodeMap<double> > coords;
26 std::string file_name;
28 ///Stores double type NodeMaps
29 std::map< std::string,Graph::NodeMap<double> * > nodemap_storage;
31 ///Stores double type EdgeMaps
32 std::map< std::string,Graph::EdgeMap<double> * > edgemap_storage;
34 //Stores the default values for the different visualization node attributes
35 std::vector<Graph::NodeMap<double> > default_nodemaps;
37 //Stores the default values for the different visualization edge attributes
38 std::vector<Graph::EdgeMap<double> > default_edgemaps;
41 ///Constructor of MapStorage. Expects the Graph of
42 ///which maps will be stored in it.
43 ///Its all activity is initializing default values
44 ///for different visualization attributes
46 ///\param graph is the graph for which the maps are stored in this object.
51 ///Adds given map to storage. A name and the map itself has to be provided.
52 ///\param name is the name of map
53 ///\nodemap is the pointer of the given nodemap
54 ///\todo map should be given by reference!
55 int addNodeMap(const std::string &,Graph::NodeMap<double> *);
57 ///Adds given map to storage. A name and the map itself has to be provided.
58 ///\param name is the name of map
59 ///\edgemap is the pointer of the given edgemap
60 ///\todo map should be given by reference!
61 int addEdgeMap(const std::string &,Graph::EdgeMap<double> *);
63 ///Returns how much nodemaps is stored in \ref MapStorage
64 int numOfNodeMaps() {return nodemap_storage.size();};
66 ///Returns how much edgemaps is stored in \ref MapStorage
67 int numOfEdgeMaps() {return edgemap_storage.size();};
69 ///Returns the maximum value of the given NodeMap. NodeMap has to be given by its name.
70 ///\param name is the name of map of which maximum is searched
71 double maxOfNodeMap(const std::string &);
73 ///Returns the maximum value of the given EdgeMap. EdgeMap has to be given by its name.
74 ///\param name is the name of map of which maximum is searched
75 double maxOfEdgeMap(const std::string &);
77 ///Returns the minimum value of the given NodeMap. NodeMap has to be given by its name.
78 ///\param name is the name of map of which minimum is searched
79 double minOfNodeMap(const std::string &);
81 ///Returns the minimum value of the given EdgeMap. EdgeMap has to be given by its name.
82 ///\param name is the name of map of which minimum is searched
83 double minOfEdgeMap(const std::string &);
85 ///To be able to iterate through each maps this function returns an iterator pointing to the first nodemap in the storage.
86 std::map< std::string,Graph::NodeMap<double> * >::iterator beginOfNodeMaps(){return nodemap_storage.begin();};
88 ///To be able to iterate through each maps this function returns an iterator pointing to the first edgemap in the storage.
89 std::map< std::string,Graph::EdgeMap<double> * >::iterator beginOfEdgeMaps(){return edgemap_storage.begin();};
91 ///To be able to iterate through each maps this function returns an iterator pointing to the last nodemap in the storage.
92 std::map< std::string,Graph::NodeMap<double> * >::iterator endOfNodeMaps(){return nodemap_storage.end();};
94 ///To be able to iterate through each maps this function returns an iterator pointing to the last edgemap in the storage.
95 std::map< std::string,Graph::EdgeMap<double> * >::iterator endOfEdgeMaps(){return edgemap_storage.end();};
97 ///This function sets a default base value for the newly created node
98 void initMapsForNode(NodeIt);
100 ///This function sets a default base value for the newly created node
101 void initMapsForEdge(Graph::Edge);
103 void readFromFile(const std::string &);
104 void writeToFile(const std::string &);
109 #endif //MAPSTORAGE_H