Changeset 64:7a32d528857f in glemon-0.x
- Timestamp:
- 08/23/05 17:57:12 (18 years ago)
- Branch:
- gui
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk/gui@2159
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
graph_displayer_canvas-event.cc
r63 r64 241 241 mapstorage.coords.set(active_node, xy<double>(clicked_x, clicked_y)); 242 242 243 // update id map244 (*mapstorage.nodemap_storage["id"])[active_node] =245 mapstorage.graph.id(active_node);246 247 243 // update all other maps 248 244 for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it = … … 250 246 mapstorage.nodemap_storage.end(); ++it) 251 247 { 252 if ((it->first != "id") && 253 (it->first != "coordinates_x") && 254 (it->first != "coordiantes_y")) 248 if ((it->first != "coordinates_x") && 249 (it->first != "coordinates_y")) 255 250 { 256 251 (*(it->second))[active_node] = … … 258 253 } 259 254 } 255 // increment the id map's default value 256 mapstorage.nodemap_default["id"] += 1.0; 260 257 261 258 nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph, … … 357 354 target_node); 358 355 359 // update id map 360 (*mapstorage.edgemap_storage["id"])[active_edge] = 361 mapstorage.graph.id(active_edge); 362 363 // update all other maps 356 // update maps 364 357 for (std::map<std::string, 365 358 Graph::EdgeMap<double>*>::const_iterator it = … … 367 360 mapstorage.edgemap_storage.end(); ++it) 368 361 { 369 if (it->first != "id") 370 { 371 (*(it->second))[active_edge] = 372 mapstorage.edgemap_default[it->first]; 373 } 362 (*(it->second))[active_edge] = 363 mapstorage.edgemap_default[it->first]; 374 364 } 365 // increment the id map's default value 366 mapstorage.edgemap_default["id"] += 1.0; 375 367 376 368 //calculating coordinates of new edge -
mapstorage.cc
r63 r64 12 12 nodemap_storage["id"] = new Graph::NodeMap<double>(graph); 13 13 edgemap_storage["id"] = new Graph::EdgeMap<double>(graph); 14 15 nodemap_default["id"] = 1.0; 16 edgemap_default["id"] = 1.0; 14 17 } 15 18 … … 126 129 bool read_x = false; 127 130 bool read_y = false; 131 bool read_edge_id = false; 128 132 129 133 try { … … 183 187 } 184 188 189 if (!read_edge_id) 190 { 191 edgemap_storage["id"] = new Graph::EdgeMap<double>(graph); 192 int i = 1; 193 for (EdgeIt e(graph); e != INVALID; ++e) 194 { 195 (*edgemap_storage["id"])[e] = i++; 196 } 197 } 198 185 199 if (!read_x || !read_y) 186 200 { … … 211 225 nodemap_default[it->first] = 0.0; 212 226 } 227 else if (it->first == "id") 228 { 229 NodeIt n(graph); 230 double max = (*nodemap_storage["id"])[n]; 231 for (; n != INVALID; ++n) 232 { 233 if ((*nodemap_storage["id"])[n] > max) 234 max = (*nodemap_storage["id"])[n]; 235 } 236 nodemap_default["id"] = max + 1.0; 237 } 213 238 } 214 239 for (std::map<std::string, Graph::EdgeMap<double>*>::const_iterator it = … … 218 243 { 219 244 edgemap_default[it->first] = 0.0; 245 } 246 else 247 { 248 EdgeIt e(graph); 249 double max = (*edgemap_storage["id"])[e]; 250 for (; e != INVALID; ++e) 251 { 252 if ((*edgemap_storage["id"])[e] > max) 253 max = (*edgemap_storage["id"])[e]; 254 } 255 edgemap_default["id"] = max + 1.0; 220 256 } 221 257 } … … 268 304 nodemap_default.begin(); it != nodemap_default.end(); ++it) 269 305 { 270 nodemap_default.erase(it); 306 if (it->first != "id") 307 nodemap_default.erase(it); 271 308 } 272 309 for (std::map<std::string, double>::iterator it = 273 310 edgemap_default.begin(); it != edgemap_default.end(); ++it) 274 311 { 275 edgemap_default.erase(it); 312 if (it->first != "id") 313 edgemap_default.erase(it); 276 314 } 277 315 graph.clear();
Note: See TracChangeset
for help on using the changeset viewer.