ladanyi@1442
|
1 |
// -*- C++ -*- //
|
ladanyi@1442
|
2 |
|
ladanyi@1442
|
3 |
#ifndef MAPSTORAGE_H
|
ladanyi@1442
|
4 |
#define MAPSTORAGE_H
|
ladanyi@1442
|
5 |
|
hegyi@1837
|
6 |
class Mapstorage;
|
hegyi@1837
|
7 |
|
ladanyi@1606
|
8 |
#include "all_include.h"
|
ladanyi@1606
|
9 |
#include "xymap.h"
|
hegyi@1837
|
10 |
#include <libgnomecanvasmm.h>
|
ladanyi@1442
|
11 |
|
ladanyi@1442
|
12 |
///Class MapStorage is responsible for storing
|
ladanyi@1442
|
13 |
///NodeMaps and EdgeMaps that can be shown later
|
ladanyi@1442
|
14 |
///on GUI. Therefore maps can be added to it,
|
ladanyi@1442
|
15 |
///and datas over the added maps can be queried.
|
ladanyi@1442
|
16 |
///The maps will be stored in an std::map,
|
ladanyi@1442
|
17 |
///referenced with their names. Unfortunately at
|
ladanyi@1442
|
18 |
///the moment it works only with double type maps
|
ladanyi@1442
|
19 |
///
|
ladanyi@1442
|
20 |
///\todo too many things are public!!
|
ladanyi@1442
|
21 |
class MapStorage
|
ladanyi@1442
|
22 |
{
|
ladanyi@1442
|
23 |
public:
|
ladanyi@1442
|
24 |
|
ladanyi@1606
|
25 |
Graph graph;
|
ladanyi@1606
|
26 |
XYMap<Graph::NodeMap<double> > coords;
|
ladanyi@1606
|
27 |
|
ladanyi@1606
|
28 |
bool modified;
|
ladanyi@1606
|
29 |
std::string file_name;
|
ladanyi@1442
|
30 |
|
ladanyi@1442
|
31 |
///Stores double type NodeMaps
|
ladanyi@1442
|
32 |
std::map< std::string,Graph::NodeMap<double> * > nodemap_storage;
|
ladanyi@1442
|
33 |
|
ladanyi@1442
|
34 |
///Stores double type EdgeMaps
|
ladanyi@1442
|
35 |
std::map< std::string,Graph::EdgeMap<double> * > edgemap_storage;
|
ladanyi@1442
|
36 |
|
ladanyi@1442
|
37 |
//Stores the default values for the different visualization node attributes
|
ladanyi@1442
|
38 |
std::vector<Graph::NodeMap<double> > default_nodemaps;
|
ladanyi@1442
|
39 |
|
ladanyi@1442
|
40 |
//Stores the default values for the different visualization edge attributes
|
ladanyi@1442
|
41 |
std::vector<Graph::EdgeMap<double> > default_edgemaps;
|
ladanyi@1442
|
42 |
|
hegyi@1837
|
43 |
//Stores the active maps for the different visualization node attributes
|
hegyi@1837
|
44 |
std::vector< std::string > active_nodemaps;
|
hegyi@1837
|
45 |
|
hegyi@1837
|
46 |
//Stores the active maps for the different visualization edge attributes
|
hegyi@1837
|
47 |
std::vector< std::string > active_edgemaps;
|
hegyi@1837
|
48 |
|
ladanyi@1645
|
49 |
// Default values for the maps
|
ladanyi@1645
|
50 |
std::map< std::string, double > nodemap_default;
|
ladanyi@1645
|
51 |
|
ladanyi@1645
|
52 |
// Default values for the maps
|
ladanyi@1645
|
53 |
std::map< std::string, double > edgemap_default;
|
ladanyi@1645
|
54 |
|
hegyi@1837
|
55 |
protected:
|
hegyi@1837
|
56 |
typedef sigc::signal<void, bool, int> Signal_Prop;
|
hegyi@1837
|
57 |
Signal_Prop signal_prop;
|
hegyi@1837
|
58 |
|
ladanyi@1442
|
59 |
public:
|
ladanyi@1442
|
60 |
///Constructor of MapStorage. Expects the Graph of
|
ladanyi@1442
|
61 |
///which maps will be stored in it.
|
ladanyi@1442
|
62 |
///Its all activity is initializing default values
|
ladanyi@1442
|
63 |
///for different visualization attributes
|
ladanyi@1442
|
64 |
///
|
ladanyi@1442
|
65 |
///\param graph is the graph for which the maps are stored in this object.
|
ladanyi@1606
|
66 |
MapStorage();
|
ladanyi@1606
|
67 |
|
ladanyi@1606
|
68 |
~MapStorage();
|
ladanyi@1442
|
69 |
|
hegyi@1837
|
70 |
void changeActiveMap(bool, int, std::string);
|
hegyi@1837
|
71 |
|
hegyi@1837
|
72 |
std::string getActiveEdgeMap(int);
|
hegyi@1837
|
73 |
std::string getActiveNodeMap(int);
|
hegyi@1837
|
74 |
|
hegyi@1837
|
75 |
std::vector<std::string> getEdgeMapList();
|
hegyi@1837
|
76 |
std::vector<std::string> getNodeMapList();
|
hegyi@1837
|
77 |
|
hegyi@1837
|
78 |
Signal_Prop signal_prop_ch();
|
hegyi@1837
|
79 |
|
ladanyi@1442
|
80 |
///Adds given map to storage. A name and the map itself has to be provided.
|
ladanyi@1442
|
81 |
///\param name is the name of map
|
ladanyi@1442
|
82 |
///\nodemap is the pointer of the given nodemap
|
ladanyi@1442
|
83 |
///\todo map should be given by reference!
|
ladanyi@1645
|
84 |
int addNodeMap(const std::string &,Graph::NodeMap<double> *, double);
|
ladanyi@1442
|
85 |
|
ladanyi@1442
|
86 |
///Adds given map to storage. A name and the map itself has to be provided.
|
ladanyi@1442
|
87 |
///\param name is the name of map
|
ladanyi@1442
|
88 |
///\edgemap is the pointer of the given edgemap
|
ladanyi@1442
|
89 |
///\todo map should be given by reference!
|
ladanyi@1645
|
90 |
int addEdgeMap(const std::string &,Graph::EdgeMap<double> *, double);
|
ladanyi@1442
|
91 |
|
ladanyi@1442
|
92 |
///Returns how much nodemaps is stored in \ref MapStorage
|
ladanyi@1442
|
93 |
int numOfNodeMaps() {return nodemap_storage.size();};
|
ladanyi@1442
|
94 |
|
ladanyi@1442
|
95 |
///Returns how much edgemaps is stored in \ref MapStorage
|
ladanyi@1442
|
96 |
int numOfEdgeMaps() {return edgemap_storage.size();};
|
ladanyi@1442
|
97 |
|
ladanyi@1442
|
98 |
///Returns the maximum value of the given NodeMap. NodeMap has to be given by its name.
|
ladanyi@1442
|
99 |
///\param name is the name of map of which maximum is searched
|
ladanyi@1442
|
100 |
double maxOfNodeMap(const std::string &);
|
ladanyi@1442
|
101 |
|
ladanyi@1442
|
102 |
///Returns the maximum value of the given EdgeMap. EdgeMap has to be given by its name.
|
ladanyi@1442
|
103 |
///\param name is the name of map of which maximum is searched
|
ladanyi@1442
|
104 |
double maxOfEdgeMap(const std::string &);
|
ladanyi@1442
|
105 |
|
ladanyi@1442
|
106 |
///Returns the minimum value of the given NodeMap. NodeMap has to be given by its name.
|
ladanyi@1442
|
107 |
///\param name is the name of map of which minimum is searched
|
ladanyi@1442
|
108 |
double minOfNodeMap(const std::string &);
|
ladanyi@1442
|
109 |
|
ladanyi@1442
|
110 |
///Returns the minimum value of the given EdgeMap. EdgeMap has to be given by its name.
|
ladanyi@1442
|
111 |
///\param name is the name of map of which minimum is searched
|
ladanyi@1442
|
112 |
double minOfEdgeMap(const std::string &);
|
ladanyi@1442
|
113 |
|
ladanyi@1442
|
114 |
///To be able to iterate through each maps this function returns an iterator pointing to the first nodemap in the storage.
|
ladanyi@1442
|
115 |
std::map< std::string,Graph::NodeMap<double> * >::iterator beginOfNodeMaps(){return nodemap_storage.begin();};
|
ladanyi@1442
|
116 |
|
ladanyi@1442
|
117 |
///To be able to iterate through each maps this function returns an iterator pointing to the first edgemap in the storage.
|
ladanyi@1442
|
118 |
std::map< std::string,Graph::EdgeMap<double> * >::iterator beginOfEdgeMaps(){return edgemap_storage.begin();};
|
hegyi@1509
|
119 |
|
hegyi@1525
|
120 |
///To be able to iterate through each maps this function returns an iterator pointing to the last nodemap in the storage.
|
hegyi@1525
|
121 |
std::map< std::string,Graph::NodeMap<double> * >::iterator endOfNodeMaps(){return nodemap_storage.end();};
|
hegyi@1525
|
122 |
|
hegyi@1525
|
123 |
///To be able to iterate through each maps this function returns an iterator pointing to the last edgemap in the storage.
|
hegyi@1525
|
124 |
std::map< std::string,Graph::EdgeMap<double> * >::iterator endOfEdgeMaps(){return edgemap_storage.end();};
|
hegyi@1525
|
125 |
|
ladanyi@1645
|
126 |
int readFromFile(const std::string &);
|
ladanyi@1606
|
127 |
void writeToFile(const std::string &);
|
ladanyi@1606
|
128 |
|
ladanyi@1606
|
129 |
void clear();
|
ladanyi@1442
|
130 |
};
|
ladanyi@1442
|
131 |
|
ladanyi@1442
|
132 |
#endif //MAPSTORAGE_H
|