14 nodemap_storage["id"] = new Graph::NodeMap<double>(graph); |
14 nodemap_storage["id"] = new Graph::NodeMap<double>(graph); |
15 edgemap_storage["id"] = new Graph::EdgeMap<double>(graph); |
15 edgemap_storage["id"] = new Graph::EdgeMap<double>(graph); |
16 |
16 |
17 nodemap_default["id"] = 1.0; |
17 nodemap_default["id"] = 1.0; |
18 edgemap_default["id"] = 1.0; |
18 edgemap_default["id"] = 1.0; |
|
19 |
|
20 active_nodemaps.resize(NODE_PROPERTY_NUM); |
|
21 for(int i=0;i<NODE_PROPERTY_NUM;i++) |
|
22 { |
|
23 active_nodemaps[i]=""; |
|
24 } |
|
25 |
|
26 active_edgemaps.resize(EDGE_PROPERTY_NUM); |
|
27 for(int i=0;i<EDGE_PROPERTY_NUM;i++) |
|
28 { |
|
29 active_edgemaps[i]=""; |
|
30 } |
19 } |
31 } |
20 |
32 |
21 MapStorage::~MapStorage() |
33 MapStorage::~MapStorage() |
22 { |
34 { |
23 for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it = |
35 for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it = |
40 // set the maps default value |
52 // set the maps default value |
41 nodemap_default[name] = default_value; |
53 nodemap_default[name] = default_value; |
42 return 0; |
54 return 0; |
43 } |
55 } |
44 return 1; |
56 return 1; |
|
57 } |
|
58 |
|
59 void MapStorage::changeActiveMap(bool itisedge, int prop, std::string mapname) |
|
60 { |
|
61 if(itisedge) |
|
62 { |
|
63 active_edgemaps[prop]=mapname; |
|
64 } |
|
65 else |
|
66 { |
|
67 active_nodemaps[prop]=mapname; |
|
68 } |
|
69 signal_prop.emit(itisedge, prop); |
|
70 } |
|
71 |
|
72 std::string MapStorage::getActiveEdgeMap(int prop) |
|
73 { |
|
74 return active_edgemaps[prop]; |
|
75 } |
|
76 |
|
77 std::string MapStorage::getActiveNodeMap(int prop) |
|
78 { |
|
79 return active_nodemaps[prop]; |
|
80 } |
|
81 |
|
82 std::vector<std::string> MapStorage::getEdgeMapList() |
|
83 { |
|
84 std::vector<std::string> eml; |
|
85 eml.resize(edgemap_storage.size()); |
|
86 int i=0; |
|
87 std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=beginOfEdgeMaps(); |
|
88 for(;emsi!=endOfEdgeMaps();emsi++) |
|
89 { |
|
90 eml[i]=(emsi->first); |
|
91 i++; |
|
92 } |
|
93 return eml; |
|
94 } |
|
95 |
|
96 std::vector<std::string> MapStorage::getNodeMapList() |
|
97 { |
|
98 std::vector<std::string> nml; |
|
99 nml.resize(nodemap_storage.size()); |
|
100 int i=0; |
|
101 std::map< std::string,Graph::NodeMap<double> * >::iterator nmsi=beginOfNodeMaps(); |
|
102 for(;nmsi!=endOfNodeMaps();nmsi++) |
|
103 { |
|
104 nml[i]=(nmsi->first); |
|
105 i++; |
|
106 } |
|
107 return nml; |
|
108 } |
|
109 |
|
110 MapStorage::Signal_Prop MapStorage::signal_prop_ch() |
|
111 { |
|
112 return signal_prop; |
45 } |
113 } |
46 |
114 |
47 int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap, double default_value = 0.0) |
115 int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap, double default_value = 0.0) |
48 { |
116 { |
49 if( edgemap_storage.find(name) == edgemap_storage.end() ) |
117 if( edgemap_storage.find(name) == edgemap_storage.end() ) |