31 return head == "@gui"; |
32 return head == "@gui"; |
32 } |
33 } |
33 |
34 |
34 void GuiReader::read(std::istream& is) |
35 void GuiReader::read(std::istream& is) |
35 { |
36 { |
|
37 using std::vector; |
|
38 using std::string; |
|
39 using std::pair; |
|
40 using std::make_pair; |
|
41 using std::string; |
|
42 using std::map; |
|
43 |
36 XmlIo x(is); |
44 XmlIo x(is); |
37 std::map<int, XY > m; |
|
38 x("arrow_pos", m); |
|
39 |
45 |
40 if ((int)m.size() == countEdges(mapstorage->graph)) |
46 { x("main_node_map_names", gui_data.main_node_map_names); } |
|
47 { x("gui_node_map_names", gui_data.gui_node_map_names); } |
|
48 |
|
49 { x("node_map_types", gui_data.node_map_types); } |
|
50 |
|
51 { x("main_edge_map_names", gui_data.main_edge_map_names); } |
|
52 { x("gui_edge_map_names", gui_data.gui_edge_map_names); } |
|
53 |
|
54 { x("edge_map_types", gui_data.edge_map_types); } |
|
55 |
|
56 for (vector<string>::const_iterator it = gui_data.gui_node_map_names.begin(); |
|
57 it != gui_data.gui_node_map_names.end(); ++it) |
|
58 { |
|
59 MapValue::Type type = gui_data.node_map_types[*it]; |
|
60 switch (type) |
41 { |
61 { |
42 for (EdgeIt e(mapstorage->graph); e != INVALID; ++e) |
62 case MapValue::NUMERIC: |
43 { |
63 { |
44 int edgeid = (int)(*mapstorage->edgemap_storage["label"])[e]; |
64 map<int, double>* p_map_data = |
45 mapstorage->arrow_pos.set(e, m[edgeid]); |
65 new map<int, double>; |
46 } |
66 gui_data.numeric_node_maps[*it] = p_map_data; |
47 mapstorage->ArrowPosReadOK(); |
67 { x(*it, *p_map_data); } |
|
68 } |
|
69 break; |
|
70 case MapValue::STRING: |
|
71 { |
|
72 map<int, string>* p_map_data = |
|
73 new map<int, string>; |
|
74 gui_data.string_node_maps[*it] = p_map_data; |
|
75 { x(*it, *p_map_data); } |
|
76 } |
|
77 break; |
48 } |
78 } |
49 |
79 } |
|
80 |
|
81 for (vector<string>::const_iterator it = gui_data.gui_edge_map_names.begin(); |
|
82 it != gui_data.gui_edge_map_names.end(); ++it) |
|
83 { |
|
84 MapValue::Type type = gui_data.edge_map_types[*it]; |
|
85 switch (type) |
|
86 { |
|
87 case MapValue::NUMERIC: |
|
88 { |
|
89 map<int, double>* p_map_data = |
|
90 new map<int, double>; |
|
91 gui_data.numeric_edge_maps[*it] = p_map_data; |
|
92 { x(*it, *p_map_data); } |
|
93 } |
|
94 break; |
|
95 case MapValue::STRING: |
|
96 { |
|
97 map<int, string>* p_map_data = |
|
98 new map<int, string>; |
|
99 gui_data.string_edge_maps[*it] = p_map_data; |
|
100 { x(*it, *p_map_data); } |
|
101 } |
|
102 break; |
|
103 } |
|
104 } |
|
105 |
|
106 { |
|
107 std::string node_coords_save_dest; |
|
108 { x("node_coords_save_dest", node_coords_save_dest); } |
|
109 if (node_coords_save_dest == "gui_sect") |
|
110 { |
|
111 // read the node coorinates |
|
112 gui_data.node_coords_save_dest = MapStorage::SpecMapSaveOpts::GUI_SECT; |
|
113 { x("node_coord_map", gui_data.node_coord_map); } |
|
114 } |
|
115 else if (node_coords_save_dest == "nodeset_sect_1_map") |
|
116 { |
|
117 gui_data.node_coords_save_dest = MapStorage::SpecMapSaveOpts::NESET_SECT; |
|
118 gui_data.node_coords_save_map_num = MapStorage::SpecMapSaveOpts::ONE_MAP; |
|
119 { x("map_name", gui_data.node_coords_one_map_name); } |
|
120 } |
|
121 else if (node_coords_save_dest == "nodeset_sect_2_maps") |
|
122 { |
|
123 gui_data.node_coords_save_dest = MapStorage::SpecMapSaveOpts::NESET_SECT; |
|
124 gui_data.node_coords_save_map_num = MapStorage::SpecMapSaveOpts::TWO_MAPS; |
|
125 { x("map1_name", gui_data.node_coords_two_maps_1_name); } |
|
126 { x("map2_name", gui_data.node_coords_two_maps_2_name); } |
|
127 } |
|
128 } |
|
129 |
|
130 { |
|
131 std::string arrow_coords_save_dest; |
|
132 { x("arrow_coords_save_dest", arrow_coords_save_dest); } |
|
133 if (arrow_coords_save_dest == "gui_sect") |
|
134 { |
|
135 // read the arrow coorinates |
|
136 gui_data.arrow_coords_save_dest = MapStorage::SpecMapSaveOpts::GUI_SECT; |
|
137 { x("arrow_coord_map", gui_data.arrow_coord_map); } |
|
138 } |
|
139 else if (arrow_coords_save_dest == "edgeset_sect_1_map") |
|
140 { |
|
141 gui_data.arrow_coords_save_dest = MapStorage::SpecMapSaveOpts::NESET_SECT; |
|
142 gui_data.arrow_coords_save_map_num = MapStorage::SpecMapSaveOpts::ONE_MAP; |
|
143 { x("map_name", gui_data.arrow_coords_one_map_name); } |
|
144 } |
|
145 else if (arrow_coords_save_dest == "edgeset_sect_2_maps") |
|
146 { |
|
147 gui_data.arrow_coords_save_dest = MapStorage::SpecMapSaveOpts::NESET_SECT; |
|
148 gui_data.arrow_coords_save_map_num = MapStorage::SpecMapSaveOpts::TWO_MAPS; |
|
149 { x("map1_name", gui_data.arrow_coords_two_maps_1_name); } |
|
150 { x("map2_name", gui_data.arrow_coords_two_maps_2_name); } |
|
151 } |
|
152 } |
|
153 |
|
154 |
|
155 |
50 std::map<int, std::string> nm; |
156 std::map<int, std::string> nm; |
51 x("active_nodemaps", nm); |
157 x("active_nodemaps", nm); |
52 |
158 |
53 for(int i=0;i<NODE_PROPERTY_NUM;i++) |
159 for(int i=0;i<NODE_PROPERTY_NUM;i++) |
54 { |
160 { |
55 mapstorage->changeActiveMap(false, i, nm[i]); |
161 mapstorage->changeActiveMap(false, i, nm[i]); |
56 } |
162 } |
57 |
163 |
58 std::map<int, std::string> em; |
164 std::map<int, std::string> em; |
59 x("active_edgemaps", em); |
165 x("active_edgemaps", em); |
60 for(int i=0;i<EDGE_PROPERTY_NUM;i++) |
166 for(int i=0;i<EDGE_PROPERTY_NUM;i++) |
61 { |
167 { |
62 mapstorage->changeActiveMap(true, i, em[i]); |
168 mapstorage->changeActiveMap(true, i, em[i]); |
63 } |
169 } |
64 |
170 |
65 double attraction; |
171 double attraction; |
66 double propulsation; |
172 double propulsation; |
67 int iteration; |
173 int iteration; |
68 |
174 |