Several changes. \n If new map is added to mapstorage it emits signal with the name of the new map. This was important, because from now on not only tha mapwin should be updated. \n Furthermore algobox gets a pointer to mapstorage instead of only the mapnames from it. This is important because without it it would be complicated to pass all of the required maps to algobox.
8 #include "all_include.h"
10 #include <libgnomecanvasmm.h>
12 ///Class MapStorage is responsible for storing
13 ///NodeMaps and EdgeMaps that can be shown later
14 ///on GUI. Therefore maps can be added to it,
15 ///and datas over the added maps can be queried.
16 ///The maps will be stored in an std::map,
17 ///referenced with their names. Unfortunately at
18 ///the moment it works only with double type maps
20 ///\todo too many things are public!!
26 /// the coordinates of the nodes
27 XYMap<Graph::NodeMap<double> > coords;
28 /// the coordinates of the arrows on the edges
29 XYMap<Graph::EdgeMap<double> > arrow_pos;
32 std::string file_name;
34 ///Stores double type NodeMaps
35 std::map< std::string,Graph::NodeMap<double> * > nodemap_storage;
37 ///Stores double type EdgeMaps
38 std::map< std::string,Graph::EdgeMap<double> * > edgemap_storage;
40 //Stores the default values for the different visualization node attributes
41 std::vector<Graph::NodeMap<double> > default_nodemaps;
43 //Stores the default values for the different visualization edge attributes
44 std::vector<Graph::EdgeMap<double> > default_edgemaps;
46 //Stores the active maps for the different visualization node attributes
47 std::vector< std::string > active_nodemaps;
49 //Stores the active maps for the different visualization edge attributes
50 std::vector< std::string > active_edgemaps;
52 // Default values for the maps
53 std::map< std::string, double > nodemap_default;
55 // Default values for the maps
56 std::map< std::string, double > edgemap_default;
58 bool arrow_pos_read_ok;
61 typedef sigc::signal<void, bool, int> Signal_Prop;
62 Signal_Prop signal_prop;
63 sigc::signal<void, std::string> signal_node_map;
64 sigc::signal<void, std::string> signal_edge_map;
67 ///Constructor of MapStorage. Expects the Graph of
68 ///which maps will be stored in it.
69 ///Its all activity is initializing default values
70 ///for different visualization attributes
72 ///\param graph is the graph for which the maps are stored in this object.
77 void changeActiveMap(bool, int, std::string);
79 std::string getActiveEdgeMap(int);
80 std::string getActiveNodeMap(int);
82 std::vector<std::string> getEdgeMapList();
83 std::vector<std::string> getNodeMapList();
85 Signal_Prop signal_prop_ch();
87 sigc::signal<void, std::string> signal_node_map_ch(){return signal_node_map;};
88 sigc::signal<void, std::string> signal_edge_map_ch(){return signal_edge_map;};
90 ///Adds given map to storage. A name and the map itself has to be provided.
91 ///\param name is the name of map
92 ///\nodemap is the pointer of the given nodemap
93 ///\todo map should be given by reference!
94 int addNodeMap(const std::string &,Graph::NodeMap<double> *, double);
96 ///Adds given map to storage. A name and the map itself has to be provided.
97 ///\param name is the name of map
98 ///\edgemap is the pointer of the given edgemap
99 ///\todo map should be given by reference!
100 int addEdgeMap(const std::string &,Graph::EdgeMap<double> *, double);
102 ///Returns how much nodemaps is stored in \ref MapStorage
103 int numOfNodeMaps() {return nodemap_storage.size();};
105 ///Returns how much edgemaps is stored in \ref MapStorage
106 int numOfEdgeMaps() {return edgemap_storage.size();};
108 ///Returns the maximum value of the given NodeMap. NodeMap has to be given by its name.
109 ///\param name is the name of map of which maximum is searched
110 double maxOfNodeMap(const std::string &);
112 ///Returns the maximum value of the given EdgeMap. EdgeMap has to be given by its name.
113 ///\param name is the name of map of which maximum is searched
114 double maxOfEdgeMap(const std::string &);
116 ///Returns the minimum value of the given NodeMap. NodeMap has to be given by its name.
117 ///\param name is the name of map of which minimum is searched
118 double minOfNodeMap(const std::string &);
120 ///Returns the minimum value of the given EdgeMap. EdgeMap has to be given by its name.
121 ///\param name is the name of map of which minimum is searched
122 double minOfEdgeMap(const std::string &);
124 ///To be able to iterate through each maps this function returns an iterator pointing to the first nodemap in the storage.
125 std::map< std::string,Graph::NodeMap<double> * >::iterator beginOfNodeMaps(){return nodemap_storage.begin();};
127 ///To be able to iterate through each maps this function returns an iterator pointing to the first edgemap in the storage.
128 std::map< std::string,Graph::EdgeMap<double> * >::iterator beginOfEdgeMaps(){return edgemap_storage.begin();};
130 ///To be able to iterate through each maps this function returns an iterator pointing to the last nodemap in the storage.
131 std::map< std::string,Graph::NodeMap<double> * >::iterator endOfNodeMaps(){return nodemap_storage.end();};
133 ///To be able to iterate through each maps this function returns an iterator pointing to the last edgemap in the storage.
134 std::map< std::string,Graph::EdgeMap<double> * >::iterator endOfEdgeMaps(){return edgemap_storage.end();};
136 int readFromFile(const std::string &);
137 void writeToFile(const std::string &);
141 void ArrowPosReadOK();
144 #endif //MAPSTORAGE_H