Changeset 194:6b2b718420eb in glemon-0.x
- Timestamp:
- 02/28/07 19:20:28 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@3205
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
algobox.cc
r174 r194 18 18 19 19 #include <algobox.h> 20 #include <mapstorage.h> 21 #include <mapselector.h> 20 22 21 23 enum {N_DEMO1, N_DEMO2, NODE_INPUT_NUM}; // input IDs for nodes; -
algobox.h
r174 r194 20 20 #define ALGOBOX_H 21 21 22 class AlgoBox; 22 class MapStorage; 23 class MapSelector; 23 24 24 25 #include <all_include.h> 25 #include <mapstorage.h>26 #include <mapselector.h>27 26 #include <libgnomecanvasmm.h> 28 27 #include <libgnomecanvasmm/polygon.h> -
algowin.cc
r174 r194 18 18 19 19 #include <algowin.h> 20 #include <algobox.h> 20 21 #include <kruskalbox.h> 21 22 #include <dijkstrabox.h> -
algowin.h
r174 r194 20 20 #define ALGOWIN_H 21 21 22 class AlgoWin;23 24 22 #include <all_include.h> 25 //#include <mapstorage.h>26 #include <algobox.h>27 23 #include <libgnomecanvasmm.h> 28 24 #include <libgnomecanvasmm/polygon.h> 29 25 26 class AlgoBox; 30 27 class MapStorage; 31 28 -
background_chooser_dialog.cc
r184 r194 1 #include "background_chooser_dialog.h"1 #include <background_chooser_dialog.h> 2 2 #include <gtkmm/stock.h> 3 #include "mapstorage.h"3 #include <mapstorage.h> 4 4 5 5 BackgroundChooserDialog::BackgroundChooserDialog(MapStorage* ms) : -
design_win.cc
r177 r194 17 17 */ 18 18 19 #include <nbtab.h> 19 20 #include <design_win.h> 20 21 -
design_win.h
r177 r194 20 20 #define DESWIN_H 21 21 22 class DesignWin;22 class NoteBookTab; 23 23 24 24 #include <all_include.h> 25 #include <nbtab.h>26 25 #include <libgnomecanvasmm.h> 27 26 #include <libgnomecanvasmm/polygon.h> -
dijkstrabox.cc
r188 r194 17 17 */ 18 18 19 #include <mapstorage.h> 20 #include <mapselector.h> 21 #include <algobox.h> 19 22 #include <dijkstrabox.h> 23 20 24 #include <lemon/dijkstra.h> 21 25 #include <lemon/suurballe.h> -
dijkstrabox.h
r174 r194 20 20 #define DIJKSTRABOX_H 21 21 22 class DijkstraBox;22 class AlgoBox; 23 23 24 24 #include <all_include.h> 25 #include <algobox.h>26 25 #include <libgnomecanvasmm.h> 27 26 #include <libgnomecanvasmm/polygon.h> -
eps_win.cc
r192 r194 17 17 */ 18 18 19 #include "eps_win.h" 19 #include <nbtab.h> 20 #include <eps_win.h> 20 21 #include <set> 21 22 -
eps_win.h
r192 r194 20 20 #define EPS_WIN_H 21 21 22 class EpsWin;22 class NoteBookTab; 23 23 24 24 #include <all_include.h> 25 #include <nbtab.h>26 #include <mapselector.h>27 25 #include <libgnomecanvasmm.h> 28 26 #include <libgnomecanvasmm/polygon.h> -
gdc-broken_edge.cc
r189 r194 17 17 */ 18 18 19 #include "graph_displayer_canvas.h" 19 #include <graph_displayer_canvas.h> 20 #include <mapstorage.h> 21 #include <nbtab.h> 20 22 #include <cmath> 21 23 … … 34 36 void GraphDisplayerCanvas::EdgeBase::drawArrow(XY unit_vector_in_dir) 35 37 { 36 MapStorage& ms = canvas.mytab.mapstorage;38 MapStorage& ms = *canvas.mytab.mapstorage; 37 39 XY center(ms.arrow_pos[edge]); 38 40 XY unit_norm_vector(0-unit_vector_in_dir.y, unit_vector_in_dir.x); … … 85 87 void GraphDisplayerCanvas::BrokenEdge::draw() 86 88 { 87 MapStorage& ms = canvas.mytab.mapstorage;89 MapStorage& ms = *canvas.mytab.mapstorage; 88 90 89 91 //calculating coordinates of the direction indicator arrow … … 151 153 Gnome::Canvas::Points points_new; 152 154 153 canvas.mytab.mapstorage .arrow_pos.set(edge, canvas.mytab.mapstorage.arrow_pos[edge] + XY(dx, dy));155 canvas.mytab.mapstorage->arrow_pos.set(edge, canvas.mytab.mapstorage->arrow_pos[edge] + XY(dx, dy)); 154 156 155 157 draw(); 156 canvas.textReposition(canvas.mytab.mapstorage .arrow_pos[edge]);158 canvas.textReposition(canvas.mytab.mapstorage->arrow_pos[edge]); 157 159 158 160 clicked_x=e->motion.x; … … 195 197 void GraphDisplayerCanvas::LoopEdge::draw() 196 198 { 197 MapStorage& ms = canvas.mytab.mapstorage;199 MapStorage& ms = *canvas.mytab.mapstorage; 198 200 199 201 Node node = ms.graph.source(edge); … … 248 250 if(isbutton) 249 251 { 250 canvas.mytab.mapstorage .arrow_pos.set(edge, XY(e->motion.x, e->motion.y));252 canvas.mytab.mapstorage->arrow_pos.set(edge, XY(e->motion.x, e->motion.y)); 251 253 252 254 draw(); 253 canvas.textReposition(canvas.mytab.mapstorage .arrow_pos[edge]);255 canvas.textReposition(canvas.mytab.mapstorage->arrow_pos[edge]); 254 256 } 255 257 default: break; -
graph-displayer.cc
r174 r194 22 22 23 23 #include "all_include.h" 24 #include "mapstorage.h"25 24 #include "main_win.h" 26 25 #include <libgnomecanvasmm.h> -
graph_displayer_canvas-edge.cc
r179 r194 17 17 */ 18 18 19 #include "graph_displayer_canvas.h" 19 #include <graph_displayer_canvas.h> 20 #include <mapstorage.h> 21 #include <nbtab.h> 20 22 #include <cmath> 21 23 … … 28 30 min=edge_property_defaults[E_WIDTH]; 29 31 max=edge_property_defaults[E_WIDTH]; 30 Graph::EdgeMap<double> actual_map((mytab.mapstorage) .graph,edge_property_defaults[E_WIDTH]);32 Graph::EdgeMap<double> actual_map((mytab.mapstorage)->graph,edge_property_defaults[E_WIDTH]); 31 33 32 34 if(edge==INVALID) 33 35 { 34 for (EdgeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)36 for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 35 37 { 36 38 double v=fabs(actual_map[i]); … … 69 71 double min, max; 70 72 71 min=(mytab.mapstorage) .minOfEdgeMap(mapname);72 max=(mytab.mapstorage) .maxOfEdgeMap(mapname);73 actual_map=((mytab.mapstorage) .edgemap_storage)[mapname];74 75 if(edge==INVALID) 76 { 77 for (EdgeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)73 min=(mytab.mapstorage)->minOfEdgeMap(mapname); 74 max=(mytab.mapstorage)->maxOfEdgeMap(mapname); 75 actual_map=((mytab.mapstorage)->edgemap_storage)[mapname]; 76 77 if(edge==INVALID) 78 { 79 for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 78 80 { 79 81 double v=(*actual_map)[i]; … … 132 134 //green in RGB 133 135 Graph::EdgeMap<double> * actual_map; 134 actual_map=((mytab.mapstorage) .edgemap_storage)[mapname];136 actual_map=((mytab.mapstorage)->edgemap_storage)[mapname]; 135 137 136 138 double max, min; 137 139 138 max=(mytab.mapstorage) .maxOfEdgeMap(mapname);139 min=(mytab.mapstorage) .minOfEdgeMap(mapname);140 141 if(edge==INVALID) 142 { 143 for (EdgeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)140 max=(mytab.mapstorage)->maxOfEdgeMap(mapname); 141 min=(mytab.mapstorage)->minOfEdgeMap(mapname); 142 143 if(edge==INVALID) 144 { 145 for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 144 146 { 145 147 double w=(*actual_map)[i]; … … 183 185 //the minimum of the nodemap to the range of 184 186 //green in RGB 185 Graph::EdgeMap<double> actual_map((mytab.mapstorage) .graph,edge_property_defaults[E_COLOR]);187 Graph::EdgeMap<double> actual_map((mytab.mapstorage)->graph,edge_property_defaults[E_COLOR]); 186 188 187 189 double max, min; … … 192 194 if(edge==INVALID) 193 195 { 194 for (EdgeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)196 for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 195 197 { 196 198 double w=actual_map[i]; … … 237 239 if(edge==INVALID) 238 240 { 239 for (EdgeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)241 for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 240 242 { 241 243 edgemap_to_edit=mapname; 242 double number=(*((mytab.mapstorage) .edgemap_storage)[mapname])[i];244 double number=(*((mytab.mapstorage)->edgemap_storage)[mapname])[i]; 243 245 244 246 std::ostringstream ostr; … … 251 253 else 252 254 { 253 double number=(*((mytab.mapstorage) .edgemap_storage)[mapname])[edge];255 double number=(*((mytab.mapstorage)->edgemap_storage)[mapname])[edge]; 254 256 255 257 std::ostringstream ostr; … … 272 274 if(edge==INVALID) 273 275 { 274 for (EdgeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)276 for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 275 277 { 276 278 edgemap_to_edit=""; -
graph_displayer_canvas-event.cc
r187 r194 17 17 */ 18 18 19 #include "graph_displayer_canvas.h" 19 #include <graph_displayer_canvas.h> 20 #include <mapstorage.h> 21 #include <nbtab.h> 20 22 #include <cmath> 21 23 … … 146 148 active_item=(get_item_at(clicked_x, clicked_y)); 147 149 active_node=INVALID; 148 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)150 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 149 151 { 150 152 if(nodesmap[i]==active_item) … … 169 171 if(active_node!=INVALID) 170 172 { 171 (mytab.mapstorage) .modified = true;173 (mytab.mapstorage)->modified = true; 172 174 173 175 //new coordinates will be the old values, … … 191 193 std::ostringstream ostr; 192 194 ostr << "(" << 193 (mytab.mapstorage) .coords[active_node].x << ", " <<194 (mytab.mapstorage) .coords[active_node].y << ")";195 (mytab.mapstorage)->coords[active_node].x << ", " << 196 (mytab.mapstorage)->coords[active_node].y << ")"; 195 197 double radius = 196 198 (nodesmap[active_node]->property_x2().get_value() - … … 199 201 { 200 202 coord_text->property_text().set_value(ostr.str()); 201 coord_text->property_x().set_value((mytab.mapstorage) .coords[active_node].x +203 coord_text->property_x().set_value((mytab.mapstorage)->coords[active_node].x + 202 204 radius); 203 coord_text->property_y().set_value((mytab.mapstorage) .coords[active_node].y -205 coord_text->property_y().set_value((mytab.mapstorage)->coords[active_node].y - 204 206 radius); 205 207 } … … 208 210 coord_text = new Gnome::Canvas::Text( 209 211 displayed_graph, 210 (mytab.mapstorage) .coords[active_node].x + radius,211 (mytab.mapstorage) .coords[active_node].y - radius,212 (mytab.mapstorage)->coords[active_node].x + radius, 213 (mytab.mapstorage)->coords[active_node].y - radius, 212 214 ostr.str()); 213 215 coord_text->property_fill_color().set_value("black"); … … 300 302 301 303 case GDK_BUTTON_RELEASE: 302 (mytab.mapstorage) .modified = true;304 (mytab.mapstorage)->modified = true; 303 305 304 306 is_drawn=true; … … 306 308 isbutton=1; 307 309 308 active_node=(mytab.mapstorage) .graph.addNode();310 active_node=(mytab.mapstorage)->graph.addNode(); 309 311 310 312 //initiating values corresponding to new node in maps … … 313 315 314 316 // update coordinates 315 (mytab.mapstorage) .coords.set(active_node, XY(clicked_x, clicked_y));317 (mytab.mapstorage)->coords.set(active_node, XY(clicked_x, clicked_y)); 316 318 317 319 // update all other maps 318 320 for (std::map<std::string, Graph::NodeMap<double>*>::const_iterator it = 319 (mytab.mapstorage) .nodemap_storage.begin(); it !=320 (mytab.mapstorage) .nodemap_storage.end(); ++it)321 (mytab.mapstorage)->nodemap_storage.begin(); it != 322 (mytab.mapstorage)->nodemap_storage.end(); ++it) 321 323 { 322 324 if ((it->first != "coordinates_x") && … … 324 326 { 325 327 (*(it->second))[active_node] = 326 (mytab.mapstorage) .nodemap_default[it->first];328 (mytab.mapstorage)->nodemap_default[it->first]; 327 329 } 328 330 } 329 331 // increment the id map's default value 330 (mytab.mapstorage) .nodemap_default["label"] += 1.0;332 (mytab.mapstorage)->nodemap_default["label"] += 1.0; 331 333 332 334 nodesmap[active_node]=new Gnome::Canvas::Ellipse(displayed_graph, … … 378 380 active_item=(get_item_at(clicked_x, clicked_y)); 379 381 active_node=INVALID; 380 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)382 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 381 383 { 382 384 if(nodesmap[i]==active_item) … … 407 409 target_item=(get_item_at(clicked_x, clicked_y)); 408 410 Node target_node=INVALID; 409 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)411 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 410 412 { 411 413 if(nodesmap[i]==target_item) … … 417 419 if(target_node!=INVALID) 418 420 { 419 (mytab.mapstorage) .modified = true;421 (mytab.mapstorage)->modified = true; 420 422 421 423 *(nodesmap[target_node]) << … … 423 425 424 426 //creating new edge 425 active_edge=(mytab.mapstorage) .graph.addEdge(active_node,427 active_edge=(mytab.mapstorage)->graph.addEdge(active_node, 426 428 target_node); 427 429 … … 429 431 for (std::map<std::string, 430 432 Graph::EdgeMap<double>*>::const_iterator it = 431 (mytab.mapstorage) .edgemap_storage.begin(); it !=432 (mytab.mapstorage) .edgemap_storage.end(); ++it)433 (mytab.mapstorage)->edgemap_storage.begin(); it != 434 (mytab.mapstorage)->edgemap_storage.end(); ++it) 433 435 { 434 436 (*(it->second))[active_edge] = 435 (mytab.mapstorage) .edgemap_default[it->first];437 (mytab.mapstorage)->edgemap_default[it->first]; 436 438 } 437 439 // increment the id map's default value 438 (mytab.mapstorage) .edgemap_default["label"] += 1.0;440 (mytab.mapstorage)->edgemap_default["label"] += 1.0; 439 441 440 442 if(target_node!=active_node) 441 443 { 442 444 // set the coordinates of the arrow on the new edge 443 MapStorage& ms = mytab.mapstorage;445 MapStorage& ms = *mytab.mapstorage; 444 446 ms.arrow_pos.set(active_edge, 445 447 (ms.coords[ms.graph.source(active_edge)] + … … 453 455 { 454 456 // set the coordinates of the arrow on the new edge 455 MapStorage& ms = mytab.mapstorage;457 MapStorage& ms = *mytab.mapstorage; 456 458 ms.arrow_pos.set(active_edge, 457 459 (ms.coords[ms.graph.source(active_edge)] + … … 464 466 465 467 //initializing edge-text as well, to empty string 466 XY text_pos=mytab.mapstorage .arrow_pos[active_edge];468 XY text_pos=mytab.mapstorage->arrow_pos[active_edge]; 467 469 text_pos+=(XY(10,10)); 468 470 … … 498 500 if(target_item) 499 501 { 500 propertyUpdate((mytab.mapstorage) .graph.target(active_edge),N_COLOR);502 propertyUpdate((mytab.mapstorage)->graph.target(active_edge),N_COLOR); 501 503 target_item=NULL; 502 504 } … … 522 524 active_edge=INVALID; 523 525 //was it a node? 524 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)526 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 525 527 { 526 528 if(nodesmap[i]==active_item) … … 532 534 if(active_node==INVALID) 533 535 { 534 for (EdgeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)536 for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 535 537 { 536 538 if(edgesmap[i]->getLine()==active_item) … … 561 563 if(active_node!=INVALID) 562 564 { 563 (mytab.mapstorage) .modified = true;565 (mytab.mapstorage)->modified = true; 564 566 565 567 std::set<Graph::Edge> edges_to_delete; 566 568 567 for(OutEdgeIt e((mytab.mapstorage) .graph,active_node);e!=INVALID;++e)569 for(OutEdgeIt e((mytab.mapstorage)->graph,active_node);e!=INVALID;++e) 568 570 { 569 571 edges_to_delete.insert(e); 570 572 } 571 573 572 for(InEdgeIt e((mytab.mapstorage) .graph,active_node);e!=INVALID;++e)574 for(InEdgeIt e((mytab.mapstorage)->graph,active_node);e!=INVALID;++e) 573 575 { 574 576 edges_to_delete.insert(e); … … 636 638 637 639 //find the activated item between text of nodes 638 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)640 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 639 641 { 640 642 //at the same time only one can be active … … 648 650 if(clicked_node==INVALID) 649 651 { 650 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)652 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 651 653 { 652 654 //at the same time only one can be active … … 661 663 { 662 664 //find the activated item between texts 663 for (EdgeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)665 for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 664 666 { 665 667 //at the same time only one can be active … … 673 675 if(clicked_edge==INVALID) 674 676 { 675 for (EdgeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)677 for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 676 678 { 677 679 //at the same time only one can be active … … 715 717 case Gtk::RESPONSE_ACCEPT: 716 718 double new_value = spin.get_value(); 717 (*(mytab.mapstorage) .nodemap_storage[nodemap_to_edit])[active_node] =719 (*(mytab.mapstorage)->nodemap_storage[nodemap_to_edit])[active_node] = 718 720 new_value; 719 721 std::ostringstream ostr; … … 758 760 case Gtk::RESPONSE_ACCEPT: 759 761 double new_value = spin.get_value(); 760 (*(mytab.mapstorage) .edgemap_storage[edgemap_to_edit])[active_edge] =762 (*(mytab.mapstorage)->edgemap_storage[edgemap_to_edit])[active_edge] = 761 763 new_value; 762 764 std::ostringstream ostr; … … 783 785 delete(nodetextmap[node_to_delete]); 784 786 delete(nodesmap[node_to_delete]); 785 (mytab.mapstorage) .graph.erase(node_to_delete);787 (mytab.mapstorage)->graph.erase(node_to_delete); 786 788 } 787 789 … … 790 792 delete(edgetextmap[edge_to_delete]); 791 793 delete(edgesmap[edge_to_delete]); 792 (mytab.mapstorage) .graph.erase(edge_to_delete);794 (mytab.mapstorage)->graph.erase(edge_to_delete); 793 795 } 794 796 … … 810 812 else 811 813 { 812 for (EdgeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)814 for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 813 815 { 814 816 if(edgesmap[i]==active_bre) … … 852 854 853 855 // the new coordinates of the centre of the node 854 double coord_x = dx + (mytab.mapstorage) .coords[moved_node].x;855 double coord_y = dy + (mytab.mapstorage) .coords[moved_node].y;856 double coord_x = dx + (mytab.mapstorage)->coords[moved_node].x; 857 double coord_y = dy + (mytab.mapstorage)->coords[moved_node].y; 856 858 857 859 // write back the new coordinates to the coords map 858 (mytab.mapstorage) .coords.set(moved_node, XY(coord_x, coord_y));860 (mytab.mapstorage)->coords.set(moved_node, XY(coord_x, coord_y)); 859 861 860 862 //all the edges connected to the moved point has to be redrawn 861 for(OutEdgeIt ei((mytab.mapstorage) .graph,moved_node);ei!=INVALID;++ei)863 for(OutEdgeIt ei((mytab.mapstorage)->graph,moved_node);ei!=INVALID;++ei) 862 864 { 863 865 XY arrow_pos; 864 866 865 if (mytab.mapstorage .graph.source(ei) == mytab.mapstorage.graph.target(ei))866 { 867 arrow_pos = mytab.mapstorage .arrow_pos[ei] + XY(dx, dy);867 if (mytab.mapstorage->graph.source(ei) == mytab.mapstorage->graph.target(ei)) 868 { 869 arrow_pos = mytab.mapstorage->arrow_pos[ei] + XY(dx, dy); 868 870 } 869 871 else … … 871 873 XY moved_node_1(coord_x - dx, coord_y - dy); 872 874 XY moved_node_2(coord_x, coord_y); 873 Node target = mytab.mapstorage .graph.target(ei);874 XY fix_node(mytab.mapstorage .coords[target].x,875 mytab.mapstorage .coords[target].y);876 XY old_arrow_pos(mytab.mapstorage .arrow_pos[ei]);875 Node target = mytab.mapstorage->graph.target(ei); 876 XY fix_node(mytab.mapstorage->coords[target].x, 877 mytab.mapstorage->coords[target].y); 878 XY old_arrow_pos(mytab.mapstorage->arrow_pos[ei]); 877 879 878 880 arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton); 879 881 } 880 882 881 mytab.mapstorage .arrow_pos.set(ei, arrow_pos);883 mytab.mapstorage->arrow_pos.set(ei, arrow_pos); 882 884 edgesmap[ei]->draw(); 883 885 884 886 //reposition of edgetext 885 XY text_pos=mytab.mapstorage .arrow_pos[ei];887 XY text_pos=mytab.mapstorage->arrow_pos[ei]; 886 888 text_pos+=(XY(10,10)); 887 889 edgetextmap[ei]->property_x().set_value(text_pos.x); … … 889 891 } 890 892 891 for(InEdgeIt ei((mytab.mapstorage) .graph,moved_node);ei!=INVALID;++ei)892 { 893 if (mytab.mapstorage .graph.source(ei) != mytab.mapstorage.graph.target(ei))893 for(InEdgeIt ei((mytab.mapstorage)->graph,moved_node);ei!=INVALID;++ei) 894 { 895 if (mytab.mapstorage->graph.source(ei) != mytab.mapstorage->graph.target(ei)) 894 896 { 895 897 XY moved_node_1(coord_x - dx, coord_y - dy); 896 898 XY moved_node_2(coord_x, coord_y); 897 Node source = mytab.mapstorage .graph.source(ei);898 XY fix_node(mytab.mapstorage .coords[source].x,899 mytab.mapstorage .coords[source].y);900 XY old_arrow_pos(mytab.mapstorage .arrow_pos[ei]);899 Node source = mytab.mapstorage->graph.source(ei); 900 XY fix_node(mytab.mapstorage->coords[source].x, 901 mytab.mapstorage->coords[source].y); 902 XY old_arrow_pos(mytab.mapstorage->arrow_pos[ei]); 901 903 902 904 XY arrow_pos; 903 905 arrow_pos = calcArrowPos(moved_node_1, moved_node_2, fix_node, old_arrow_pos, isbutton); 904 906 905 mytab.mapstorage .arrow_pos.set(ei, arrow_pos);907 mytab.mapstorage->arrow_pos.set(ei, arrow_pos); 906 908 edgesmap[ei]->draw(); 907 909 908 910 //reposition of edgetext 909 XY text_pos=mytab.mapstorage .arrow_pos[ei];911 XY text_pos=mytab.mapstorage->arrow_pos[ei]; 910 912 text_pos+=(XY(10,10)); 911 913 edgetextmap[ei]->property_x().set_value(text_pos.x); -
graph_displayer_canvas-node.cc
r179 r194 17 17 */ 18 18 19 #include "graph_displayer_canvas.h" 19 #include <graph_displayer_canvas.h> 20 #include <mapstorage.h> 21 #include <nbtab.h> 20 22 #include <cmath> 21 23 … … 26 28 Graph::NodeMap<double> * actual_map; 27 29 double min, max; 28 min=(mytab.mapstorage) .minOfNodeMap(mapname);29 max=(mytab.mapstorage) .maxOfNodeMap(mapname);30 actual_map=((mytab.mapstorage) .nodemap_storage)[mapname];31 32 if(node==INVALID) 33 { 34 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)30 min=(mytab.mapstorage)->minOfNodeMap(mapname); 31 max=(mytab.mapstorage)->maxOfNodeMap(mapname); 32 actual_map=((mytab.mapstorage)->nodemap_storage)[mapname]; 33 34 if(node==INVALID) 35 { 36 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 35 37 { 36 38 double v=fabs((*actual_map)[i]); … … 104 106 min=node_property_defaults[N_RADIUS]; 105 107 max=node_property_defaults[N_RADIUS]; 106 Graph::NodeMap<double> actual_map((mytab.mapstorage) .graph,node_property_defaults[N_RADIUS]);108 Graph::NodeMap<double> actual_map((mytab.mapstorage)->graph,node_property_defaults[N_RADIUS]); 107 109 108 110 if(node==INVALID) 109 111 { 110 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)112 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 111 113 { 112 114 double v=fabs(actual_map[i]); … … 168 170 169 171 Graph::NodeMap<double> * actual_map; 170 actual_map=((mytab.mapstorage) .nodemap_storage)[mapname];172 actual_map=((mytab.mapstorage)->nodemap_storage)[mapname]; 171 173 172 174 double max, min; 173 175 174 max=(mytab.mapstorage) .maxOfNodeMap(mapname);175 min=(mytab.mapstorage) .minOfNodeMap(mapname);176 177 if(node==INVALID) 178 { 179 180 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)176 max=(mytab.mapstorage)->maxOfNodeMap(mapname); 177 min=(mytab.mapstorage)->minOfNodeMap(mapname); 178 179 if(node==INVALID) 180 { 181 182 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 181 183 { 182 184 Gdk::Color color; … … 223 225 //green in RGB 224 226 225 Graph::NodeMap<double> actual_map((mytab.mapstorage) .graph,node_property_defaults[N_COLOR]);227 Graph::NodeMap<double> actual_map((mytab.mapstorage)->graph,node_property_defaults[N_COLOR]); 226 228 227 229 double max, min; … … 233 235 { 234 236 235 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)237 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 236 238 { 237 239 Gdk::Color color; … … 280 282 281 283 Graph::NodeMap<double> * actual_map=NULL; 282 actual_map=((mytab.mapstorage) .nodemap_storage)[mapname];283 284 if(node==INVALID) 285 { 286 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)284 actual_map=((mytab.mapstorage)->nodemap_storage)[mapname]; 285 286 if(node==INVALID) 287 { 288 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 287 289 { 288 290 nodemap_to_edit=mapname; … … 317 319 if(node==INVALID) 318 320 { 319 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)321 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 320 322 { 321 323 nodemap_to_edit=""; -
graph_displayer_canvas-zoom.cc
r174 r194 17 17 */ 18 18 19 #include "graph_displayer_canvas.h"19 #include <graph_displayer_canvas.h> 20 20 #include <cmath> 21 21 -
graph_displayer_canvas.cc
r190 r194 17 17 */ 18 18 19 #include "graph_displayer_canvas.h" 19 #include <mapstorage.h> 20 #include <nbtab.h> 21 #include <graph_displayer_canvas.h> 20 22 #include <lemon/random.h> 21 23 #include <cmath> 22 24 23 25 GraphDisplayerCanvas::GraphDisplayerCanvas(NoteBookTab & mainw) : 24 nodesmap(mainw.mapstorage .graph), edgesmap(mainw.mapstorage.graph), edgetextmap(mainw.mapstorage.graph),25 nodetextmap(mainw.mapstorage .graph), displayed_graph(*(root()), 0, 0),26 nodesmap(mainw.mapstorage->graph), edgesmap(mainw.mapstorage->graph), edgetextmap(mainw.mapstorage->graph), 27 nodetextmap(mainw.mapstorage->graph), displayed_graph(*(root()), 0, 0), 26 28 isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""), 27 29 edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), edge_width(10), … … 50 52 delete background; 51 53 } 52 if (mytab.mapstorage .isBackgroundSet())54 if (mytab.mapstorage->isBackgroundSet()) 53 55 { 54 56 background_set = true; 55 57 refBackground = Gdk::Pixbuf::create_from_file( 56 mytab.mapstorage .getBackgroundFilename());58 mytab.mapstorage->getBackgroundFilename()); 57 59 background = new Gnome::Canvas::Pixbuf( 58 60 *(root()), … … 70 72 GraphDisplayerCanvas::~GraphDisplayerCanvas() 71 73 { 72 for (NodeIt n((mytab.mapstorage) .graph); n != INVALID; ++n)74 for (NodeIt n((mytab.mapstorage)->graph); n != INVALID; ++n) 73 75 { 74 76 delete nodesmap[n]; … … 76 78 } 77 79 78 for (EdgeIt e((mytab.mapstorage) .graph); e != INVALID; ++e)80 for (EdgeIt e((mytab.mapstorage)->graph); e != INVALID; ++e) 79 81 { 80 82 delete edgesmap[e]; … … 119 121 if(mapname!="") 120 122 { 121 if( ( ((mytab.mapstorage) .nodemap_storage).find(mapname) != ((mytab.mapstorage).nodemap_storage).end() ) )123 if( ( ((mytab.mapstorage)->nodemap_storage).find(mapname) != ((mytab.mapstorage)->nodemap_storage).end() ) ) 122 124 { 123 125 switch(prop) … … 166 168 if(mapname!="") 167 169 { 168 if( ( ((mytab.mapstorage) .edgemap_storage).find(mapname) != ((mytab.mapstorage).edgemap_storage).end() ) )170 if( ( ((mytab.mapstorage)->edgemap_storage).find(mapname) != ((mytab.mapstorage)->edgemap_storage).end() ) ) 169 171 { 170 172 switch(prop) … … 208 210 //first edges are drawn, to hide joining with nodes later 209 211 210 for (EdgeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)211 { 212 if (mytab.mapstorage .graph.source(i) == mytab.mapstorage.graph.target(i))212 for (EdgeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 213 { 214 if (mytab.mapstorage->graph.source(i) == mytab.mapstorage->graph.target(i)) 213 215 { 214 216 edgesmap[i]=new LoopEdge(displayed_graph, i, *this); … … 220 222 //initializing edge-text as well, to empty string 221 223 222 XY text_pos=mytab.mapstorage .arrow_pos[i];224 XY text_pos=mytab.mapstorage->arrow_pos[i]; 223 225 text_pos+=(XY(10,10)); 224 226 … … 231 233 //afterwards nodes come to be drawn 232 234 233 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)235 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 234 236 { 235 237 //drawing bule nodes, with black line around them … … 237 239 nodesmap[i]=new Gnome::Canvas::Ellipse( 238 240 displayed_graph, 239 (mytab.mapstorage) .coords[i].x-20,240 (mytab.mapstorage) .coords[i].y-20,241 (mytab.mapstorage) .coords[i].x+20,242 (mytab.mapstorage) .coords[i].y+20);241 (mytab.mapstorage)->coords[i].x-20, 242 (mytab.mapstorage)->coords[i].y-20, 243 (mytab.mapstorage)->coords[i].x+20, 244 (mytab.mapstorage)->coords[i].y+20); 243 245 *(nodesmap[i]) << Gnome::Canvas::Properties::fill_color("blue"); 244 246 *(nodesmap[i]) << Gnome::Canvas::Properties::outline_color("black"); … … 248 250 249 251 XY text_pos( 250 ((mytab.mapstorage) .coords[i].x+node_property_defaults[N_RADIUS]+5),251 ((mytab.mapstorage) .coords[i].y+node_property_defaults[N_RADIUS]+5));252 ((mytab.mapstorage)->coords[i].x+node_property_defaults[N_RADIUS]+5), 253 ((mytab.mapstorage)->coords[i].y+node_property_defaults[N_RADIUS]+5)); 252 254 253 255 nodetextmap[i]=new Gnome::Canvas::Text(displayed_graph, … … 282 284 forming_edge=INVALID; 283 285 284 for (NodeIt n((mytab.mapstorage) .graph); n != INVALID; ++n)286 for (NodeIt n((mytab.mapstorage)->graph); n != INVALID; ++n) 285 287 { 286 288 delete nodesmap[n]; … … 288 290 } 289 291 290 for (EdgeIt e((mytab.mapstorage) .graph); e != INVALID; ++e)292 for (EdgeIt e((mytab.mapstorage)->graph); e != INVALID; ++e) 291 293 { 292 294 delete edgesmap[e]; … … 324 326 void GraphDisplayerCanvas::reDesignGraph() 325 327 { 326 NodeIt firstnode((mytab.mapstorage) .graph);328 NodeIt firstnode((mytab.mapstorage)->graph); 327 329 //is it not an empty graph? 328 330 if(firstnode!=INVALID) … … 334 336 if(!was_redesigned) 335 337 { 336 NodeIt i((mytab.mapstorage) .graph);338 NodeIt i((mytab.mapstorage)->graph); 337 339 338 340 dim2::Point<double> init(init_vector_length*rnd(), … … 346 348 int iterations; 347 349 348 (mytab.mapstorage) .get_design_data(attraction, propulsation, iterations);350 (mytab.mapstorage)->get_design_data(attraction, propulsation, iterations); 349 351 350 352 //iteration counter 351 353 for(int l=0;l<iterations;l++) 352 354 { 353 Graph::NodeMap<double> x(mytab.mapstorage .graph);354 Graph::NodeMap<double> y(mytab.mapstorage .graph);355 Graph::NodeMap<double> x(mytab.mapstorage->graph); 356 Graph::NodeMap<double> y(mytab.mapstorage->graph); 355 357 XYMap<Graph::NodeMap<double> > actual_forces; 356 358 actual_forces.setXMap(x); … … 358 360 359 361 //count actual force for each nodes 360 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)362 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 361 363 { 362 364 //propulsation of nodes 363 for (NodeIt j((mytab.mapstorage) .graph); j!=INVALID; ++j)365 for (NodeIt j((mytab.mapstorage)->graph); j!=INVALID; ++j) 364 366 { 365 367 if(i!=j) 366 368 { 367 369 lemon::dim2::Point<double> delta = 368 ((mytab.mapstorage) .coords[i]-369 (mytab.mapstorage) .coords[j]);370 ((mytab.mapstorage)->coords[i]- 371 (mytab.mapstorage)->coords[j]); 370 372 371 373 const double length_sqr=std::max(delta.normSquare(),min_dist); … … 382 384 } 383 385 //attraction of nodes, to which actual node is bound 384 for(OutEdgeIt ei((mytab.mapstorage) .graph,i);ei!=INVALID;++ei)386 for(OutEdgeIt ei((mytab.mapstorage)->graph,i);ei!=INVALID;++ei) 385 387 { 386 388 lemon::dim2::Point<double> delta = 387 ((mytab.mapstorage) .coords[i]-388 (mytab.mapstorage) .coords[mytab.mapstorage.389 ((mytab.mapstorage)->coords[i]- 390 (mytab.mapstorage)->coords[mytab.mapstorage-> 389 391 graph.target(ei)]); 390 392 … … 395 397 actual_forces.set(i,actual_forces[i]-delta); 396 398 } 397 for(InEdgeIt ei((mytab.mapstorage) .graph,i);ei!=INVALID;++ei)399 for(InEdgeIt ei((mytab.mapstorage)->graph,i);ei!=INVALID;++ei) 398 400 { 399 401 lemon::dim2::Point<double> delta = 400 ((mytab.mapstorage) .coords[i]-401 (mytab.mapstorage) .coords[mytab.mapstorage.402 ((mytab.mapstorage)->coords[i]- 403 (mytab.mapstorage)->coords[mytab.mapstorage-> 402 404 graph.source(ei)]); 403 405 … … 409 411 } 410 412 } 411 for (NodeIt i((mytab.mapstorage) .graph); i!=INVALID; ++i)412 { 413 if(((mytab.mapstorage) .coords[i].x)+actual_forces[i].x>max_coord)414 { 415 actual_forces[i].x=max_coord-((mytab.mapstorage) .coords[i].x);416 std::cout << "Correction! " << (((mytab.mapstorage) .coords[i].x)+actual_forces[i].x) << std::endl;417 } 418 else if(((mytab.mapstorage) .coords[i].x)+actual_forces[i].x<(0-max_coord))419 { 420 actual_forces[i].x=0-max_coord-((mytab.mapstorage) .coords[i].x);421 std::cout << "Correction! " << (((mytab.mapstorage) .coords[i].x)+actual_forces[i].x) << std::endl;422 } 423 if(((mytab.mapstorage) .coords[i].y)+actual_forces[i].y>max_coord)424 { 425 actual_forces[i].y=max_coord-((mytab.mapstorage) .coords[i].y);426 std::cout << "Correction! " << (((mytab.mapstorage) .coords[i].y)+actual_forces[i].y) << std::endl;427 } 428 else if(((mytab.mapstorage) .coords[i].y)+actual_forces[i].y<(0-max_coord))429 { 430 actual_forces[i].y=0-max_coord-((mytab.mapstorage) .coords[i].y);431 std::cout << "Correction! " << (((mytab.mapstorage) .coords[i].y)+actual_forces[i].y) << std::endl;413 for (NodeIt i((mytab.mapstorage)->graph); i!=INVALID; ++i) 414 { 415 if(((mytab.mapstorage)->coords[i].x)+actual_forces[i].x>max_coord) 416 { 417 actual_forces[i].x=max_coord-((mytab.mapstorage)->coords[i].x); 418 std::cout << "Correction! " << (((mytab.mapstorage)->coords[i].x)+actual_forces[i].x) << std::endl; 419 } 420 else if(((mytab.mapstorage)->coords[i].x)+actual_forces[i].x<(0-max_coord)) 421 { 422 actual_forces[i].x=0-max_coord-((mytab.mapstorage)->coords[i].x); 423 std::cout << "Correction! " << (((mytab.mapstorage)->coords[i].x)+actual_forces[i].x) << std::endl; 424 } 425 if(((mytab.mapstorage)->coords[i].y)+actual_forces[i].y>max_coord) 426 { 427 actual_forces[i].y=max_coord-((mytab.mapstorage)->coords[i].y); 428 std::cout << "Correction! " << (((mytab.mapstorage)->coords[i].y)+actual_forces[i].y) << std::endl; 429 } 430 else if(((mytab.mapstorage)->coords[i].y)+actual_forces[i].y<(0-max_coord)) 431 { 432 actual_forces[i].y=0-max_coord-((mytab.mapstorage)->coords[i].y); 433 std::cout << "Correction! " << (((mytab.mapstorage)->coords[i].y)+actual_forces[i].y) << std::endl; 432 434 } 433 435 moveNode(actual_forces[i].x, actual_forces[i].y, nodesmap[i], i); -
graph_displayer_canvas.h
r187 r194 20 20 #define GRAPH_DISPLAYER_CANVAS_H 21 21 22 class GraphDisplayerCanvas;22 class NoteBookTab; 23 23 24 24 #include "all_include.h" 25 #include "nbtab.h"26 25 #include <libgnomecanvasmm.h> 27 26 #include <libgnomecanvasmm/polygon.h> 28 #include <lemon/dim2.h>29 27 30 28 ///This class is the canvas, on which the graph can be drawn. -
gui_reader.cc
r177 r194 17 17 */ 18 18 19 #include "gui_reader.h" 20 #include "xml.h" 21 #include "mapstorage.h" 19 #include <gui_reader.h> 20 #include <mapstorage.h> 21 22 #include <xml.h> 22 23 #include <lemon/dim2.h> 23 24 #include <vector> -
gui_reader.h
r174 r194 19 19 #ifndef GUI_READER_H 20 20 #define GUI_READER_H 21 #include <lemon/lemon_reader.h> 21 22 22 #include "mapstorage.h" 23 #include <lemon/lemon_reader.h> 23 class MapStorage; 24 24 25 25 using lemon::LemonReader; -
gui_writer.cc
r177 r194 17 17 */ 18 18 19 #include "gui_writer.h" 20 #include "xml.h" 21 #include "mapstorage.h" 19 #include <xml.h> 22 20 #include <lemon/dim2.h> 23 21 #include <vector> 22 23 #include <gui_writer.h> 24 #include <mapstorage.h> 24 25 25 26 std::string GuiWriter::header() -
gui_writer.h
r174 r194 20 20 #define GUI_WRITER_H 21 21 22 #include "mapstorage.h"23 22 #include <lemon/lemon_writer.h> 23 24 class MapStorage; 24 25 25 26 using lemon::LemonWriter; -
kruskalbox.cc
r174 r194 17 17 */ 18 18 19 #include <lemon/kruskal.h> 20 21 #include <mapstorage.h> 22 #include <mapselector.h> 23 #include <algobox.h> 19 24 #include <kruskalbox.h> 20 25 -
kruskalbox.h
r174 r194 20 20 #define KRUSKALBOX_H 21 21 22 class KruskalBox;22 class AlgoBox; 23 23 24 24 #include <all_include.h> 25 #include <algobox.h>26 #include <lemon/kruskal.h>27 25 #include <libgnomecanvasmm.h> 28 26 #include <libgnomecanvasmm/polygon.h> -
main_win.cc
r191 r194 21 21 #endif 22 22 23 #include "main_win.h" 24 #include "guipixbufs.h" 25 #include "background_chooser_dialog.h" 23 #include <main_win.h> 24 #include <guipixbufs.h> 25 #include <background_chooser_dialog.h> 26 27 #include <mapstorage.h> 28 #include <graph_displayer_canvas.h> 29 #include <algowin.h> 30 #include <new_map_win.h> 31 #include <nbtab.h> 26 32 27 33 #include "i18n.h" … … 365 371 if(active_tab!=-1) 366 372 { 367 if (tabs[active_tab]->mapstorage .modified)373 if (tabs[active_tab]->mapstorage->modified) 368 374 { 369 375 Gtk::MessageDialog mdialog(_("<b>Save changes before closing?</b>"), true, … … 554 560 { 555 561 } 556 awp->update_maplist( &(tabs[i]->mapstorage));562 awp->update_maplist(tabs[i]->mapstorage); 557 563 } 558 564 … … 633 639 void MainWin::createBackgroundChooser() 634 640 { 635 BackgroundChooserDialog dialog( &(tabs[active_tab]->mapstorage));641 BackgroundChooserDialog dialog(tabs[active_tab]->mapstorage); 636 642 dialog.run(); 637 643 } -
main_win.h
r191 r194 21 21 22 22 #include "all_include.h" 23 #include "algowin.h"24 #include "map_win.h"25 #include "new_map_win.h"26 #include "nbtab.h"27 23 #include <libgnomecanvasmm.h> 28 24 #include <libgnomecanvasmm/polygon.h> 29 25 26 class AlgoWin; 27 class NoteBookTab; 30 28 31 29 ///This class is the main window of GUI. -
map_win.cc
r174 r194 17 17 */ 18 18 19 #include "map_win.h" 19 #include <map_win.h> 20 #include <nbtab.h> 21 #include <mapselector.h> 20 22 #include <set> 21 23 -
map_win.h
r174 r194 20 20 #define MAP_WIN_H 21 21 22 class MapWin; 22 class NoteBookTab; 23 class MapSelector; 23 24 24 25 #include <all_include.h> 25 #include <nbtab.h>26 #include <mapselector.h>27 26 #include <libgnomecanvasmm.h> 28 27 #include <libgnomecanvasmm/polygon.h> -
mapselector.cc
r174 r194 17 17 */ 18 18 19 #include "mapselector.h"19 #include <mapselector.h> 20 20 21 21 MapSelector::MapSelector(std::vector<std::string> ml, std::string act, std::string labeltext, bool edge, bool d):def(d),itisedge(edge),set_new_map(false) -
mapselector.h
r174 r194 20 20 #define MAPSELECTOR_H 21 21 22 class MapSelector;23 24 22 #include <all_include.h> 25 #include <map_win.h>26 23 #include <libgnomecanvasmm.h> 27 24 #include <libgnomecanvasmm/polygon.h> -
mapstorage.cc
r191 r194 17 17 */ 18 18 19 #include "mapstorage.h"20 #include "nbtab.h"21 #include "gui_writer.h"22 #include "gui_reader.h"23 19 #include <limits> 24 20 #include <cmath> 25 21 #include <gtkmm.h> 26 #include<lemon/graph_to_eps.h> 22 23 #include <mapstorage.h> 24 #include <graph_displayer_canvas.h> //kivenni 25 #include <nbtab.h> //kivenni 26 #include <gui_writer.h> 27 #include <gui_reader.h> 28 #include <lemon/graph_to_eps.h> 27 29 28 30 const int i_d=20; -
mapstorage.h
r191 r194 20 20 #define MAPSTORAGE_H 21 21 22 class Mapstorage; 23 24 #include "all_include.h" 25 #include "xymap.h" 22 #include <all_include.h> 23 #include <xymap.h> 26 24 #include <libgnomecanvasmm.h> 27 25 -
nbtab.cc
r191 r194 18 18 19 19 #include <nbtab.h> 20 #include <mapstorage.h> 20 21 #include <eps_win.h> 21 22 NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false), mapstorage(*this) 23 { 22 #include <map_win.h> 23 #include <design_win.h> 24 #include <graph_displayer_canvas.h> 25 26 27 28 NoteBookTab::NoteBookTab():mapwinexists(false), designwinexists(false) 29 { 30 mapstorage=new MapStorage(*this); 31 24 32 Gtk::ScrolledWindow *pScrolledWindow = manage(new Gtk::ScrolledWindow); 25 33 gd_canvas=new GraphDisplayerCanvas(*this); … … 28 36 29 37 //connecting signals - controller character 30 mapstorage .signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange));31 mapstorage .signal_node_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewNodeMap));32 mapstorage .signal_edge_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewEdgeMap));38 mapstorage->signal_prop_ch().connect(sigc::mem_fun(*gd_canvas, &GraphDisplayerCanvas::propertyChange)); 39 mapstorage->signal_node_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewNodeMap)); 40 mapstorage->signal_edge_map_ch().connect(sigc::mem_fun(*this, &NoteBookTab::registerNewEdgeMap)); 33 41 show_all_children(); 34 42 show(); … … 37 45 void NoteBookTab::readFile(const std::string &file) 38 46 { 39 mapstorage .readFromFile(file);40 mapstorage .file_name = file;41 mapstorage .modified = false;47 mapstorage->readFromFile(file); 48 mapstorage->file_name = file; 49 mapstorage->modified = false; 42 50 gd_canvas->drawGraph(); 43 51 if(mapwinexists) 44 52 { 45 mapwin->update(mapstorage .getEdgeMapList(), mapstorage.getNodeMapList());53 mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList()); 46 54 } 47 55 signal_title.emit(Glib::filename_display_basename(file)); … … 50 58 void NoteBookTab::newFile() 51 59 { 52 if (mapstorage .modified)60 if (mapstorage->modified) 53 61 { 54 62 Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, … … 69 77 } 70 78 gd_canvas->clear(); 71 mapstorage .clear();72 if(mapwinexists) 73 { 74 mapwin->update(mapstorage .getEdgeMapList(), mapstorage.getNodeMapList());79 mapstorage->clear(); 80 if(mapwinexists) 81 { 82 mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList()); 75 83 } 76 84 signal_title.emit("unsaved file"); … … 79 87 void NoteBookTab::openFile() 80 88 { 81 if (mapstorage .modified)89 if (mapstorage->modified) 82 90 { 83 91 Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, … … 103 111 { 104 112 gd_canvas->clear(); 105 mapstorage .clear();113 mapstorage->clear(); 106 114 Glib::ustring filename = fcdialog.get_filename(); 107 if (!mapstorage .readFromFile(filename))108 { 109 mapstorage .file_name = filename;110 mapstorage .modified = false;115 if (!mapstorage->readFromFile(filename)) 116 { 117 mapstorage->file_name = filename; 118 mapstorage->modified = false; 111 119 gd_canvas->drawGraph(); 112 120 if(mapwinexists) 113 121 { 114 mapwin->update(mapstorage .getEdgeMapList(), mapstorage.getNodeMapList());122 mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList()); 115 123 } 116 124 signal_title.emit(Glib::filename_display_basename(filename)); … … 121 129 void NoteBookTab::saveFile() 122 130 { 123 if (mapstorage .file_name == "") {131 if (mapstorage->file_name == "") { 124 132 saveFileAs(); 125 133 } 126 134 else 127 135 { 128 mapstorage .writeToFile(mapstorage.file_name);129 mapstorage .modified = false;130 signal_title.emit(Glib::filename_display_basename(mapstorage .file_name));136 mapstorage->writeToFile(mapstorage->file_name); 137 mapstorage->modified = false; 138 signal_title.emit(Glib::filename_display_basename(mapstorage->file_name)); 131 139 } 132 140 } … … 140 148 { 141 149 Glib::ustring filename = fcdialog.get_filename(); 142 mapstorage .file_name = filename;143 mapstorage .writeToFile(filename);144 mapstorage .modified = false;150 mapstorage->file_name = filename; 151 mapstorage->writeToFile(filename); 152 mapstorage->modified = false; 145 153 signal_title.emit(Glib::filename_display_basename(filename)); 146 154 } … … 149 157 void NoteBookTab::close() 150 158 { 151 if (mapstorage .modified)159 if (mapstorage->modified) 152 160 { 153 161 Gtk::MessageDialog mdialog("<b>Save changes before closing?</b>", true, … … 168 176 } 169 177 gd_canvas->clear(); 170 mapstorage .clear();171 if(mapwinexists) 172 { 173 mapwin->update(mapstorage .getEdgeMapList(), mapstorage.getNodeMapList());178 mapstorage->clear(); 179 if(mapwinexists) 180 { 181 mapwin->update(mapstorage->getEdgeMapList(), mapstorage->getNodeMapList()); 174 182 } 175 183 signal_title.emit("unsaved file"); … … 178 186 void NoteBookTab::propertyChange(bool itisedge, int prop, std::string mapname) 179 187 { 180 mapstorage .changeActiveMap(itisedge, prop, mapname);188 mapstorage->changeActiveMap(itisedge, prop, mapname); 181 189 } 182 190 … … 193 201 std::string NoteBookTab::getActiveEdgeMap(int prop) 194 202 { 195 return mapstorage .getActiveEdgeMap(prop);203 return mapstorage->getActiveEdgeMap(prop); 196 204 } 197 205 198 206 std::string NoteBookTab::getActiveNodeMap(int prop) 199 207 { 200 return mapstorage .getActiveNodeMap(prop);208 return mapstorage->getActiveNodeMap(prop); 201 209 } 202 210 … … 221 229 if(!mapwinexists) 222 230 { 223 mapwin=new MapWin("Map Setup - "+name, mapstorage .getEdgeMapList(), mapstorage.getNodeMapList(), *this);224 mapst2mapwin=mapstorage .signal_map_win_ch().connect(sigc::mem_fun(*mapwin, &MapWin::changeEntry));231 mapwin=new MapWin("Map Setup - "+name, mapstorage->getEdgeMapList(), mapstorage->getNodeMapList(), *this); 232 mapst2mapwin=mapstorage->signal_map_win_ch().connect(sigc::mem_fun(*mapwin, &MapWin::changeEntry)); 225 233 mapwin->show(); 226 234 mapwinexists=true; … … 245 253 double attraction, propulsation; 246 254 int iterations; 247 mapstorage .get_design_data(attraction, propulsation, iterations);255 mapstorage->get_design_data(attraction, propulsation, iterations); 248 256 designwin=new DesignWin("Design Setup - "+name, attraction, propulsation, iterations, *this); 249 257 … … 255 263 designwin->signal_delete_event().connect(sigc::mem_fun(*this, &NoteBookTab::closeDesignWin)); 256 264 257 mapst2designwin=mapstorage .signal_design_win_ch().connect(sigc::mem_fun(*designwin, &DesignWin::set_data));265 mapst2designwin=mapstorage->signal_design_win_ch().connect(sigc::mem_fun(*designwin, &DesignWin::set_data)); 258 266 259 267 designwin->show(); … … 307 315 void NoteBookTab::active_maps_needed() 308 316 { 309 mapstorage .broadcastActiveMaps();317 mapstorage->broadcastActiveMaps(); 310 318 } 311 319 312 320 void NoteBookTab::exportGraphToEPS(std::vector<bool> options, std::string filename) 313 321 { 314 mapstorage .exportGraphToEPS(options, filename);315 } 322 mapstorage->exportGraphToEPS(options, filename); 323 } -
nbtab.h
r191 r194 20 20 #define NBTAB_H 21 21 22 class NoteBookTab; 23 24 #include "mapstorage.h" 25 #include "map_win.h" 26 //#include "eps_win.h" 22 class MapStorage; 27 23 class EpsWin; 28 #include "design_win.h" 29 #include "graph_displayer_canvas.h" 24 class MapWin; 25 class DesignWin; 26 class GraphDisplayerCanvas; 27 30 28 #include <libgnomecanvasmm.h> 31 29 #include <libgnomecanvasmm/polygon.h> … … 60 58 61 59 ///Maps assigned to the graph displayed in this \ref NoteBookTab of notebook. 62 MapStorage mapstorage;60 MapStorage * mapstorage; 63 61 64 62 ///Title changement indicator. -
new_map_win.cc
r174 r194 18 18 19 19 #include <new_map_win.h> 20 #include <nbtab.h> 21 #include <mapstorage.h> 20 22 21 23 bool NewMapWin::closeIfEscapeIsPressed(GdkEventKey* e) … … 120 122 { 121 123 //create the new map 122 Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (mytab.mapstorage .graph, def_val);124 Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (mytab.mapstorage->graph, def_val); 123 125 124 126 if(!only_nums) … … 126 128 std::stack<double> polishstack; 127 129 128 for(EdgeIt k(mytab.mapstorage .graph); k!=INVALID; ++k)130 for(EdgeIt k(mytab.mapstorage->graph); k!=INVALID; ++k) 129 131 { 130 132 for(int i=0;i<(int)polishform.size();i++) … … 145 147 default: 146 148 //substitute variable 147 std::map< std::string,Graph::EdgeMap<double> * > ems=mytab.mapstorage .edgemap_storage;149 std::map< std::string,Graph::EdgeMap<double> * > ems=mytab.mapstorage->edgemap_storage; 148 150 bool itisvar=(ems.find(ch2var[ polishform[i] ])!=ems.end()); 149 151 if(itisvar) 150 152 { 151 polishstack.push( (*(mytab.mapstorage .edgemap_storage[ ch2var[ polishform[i] ] ]))[k]);153 polishstack.push( (*(mytab.mapstorage->edgemap_storage[ ch2var[ polishform[i] ] ]))[k]); 152 154 } 153 155 else … … 188 190 //if addition was not successful addEdgeMap returns one. 189 191 //cause can be that there is already a map named like the new one 190 if(mytab.mapstorage .addEdgeMap(mapname, emptr, def_val))192 if(mytab.mapstorage->addEdgeMap(mapname, emptr, def_val)) 191 193 { 192 194 abortion=1; … … 203 205 { 204 206 //create the new map 205 Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (mytab.mapstorage .graph, def_val);207 Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (mytab.mapstorage->graph, def_val); 206 208 207 209 if(!only_nums) … … 209 211 std::stack<double> polishstack; 210 212 211 for(NodeIt k(mytab.mapstorage .graph); k!=INVALID; ++k)213 for(NodeIt k(mytab.mapstorage->graph); k!=INVALID; ++k) 212 214 { 213 215 for(int i=0;i<(int)polishform.size();i++) … … 227 229 break; 228 230 default: 229 std::map< std::string,Graph::NodeMap<double> * > nms=mytab.mapstorage .nodemap_storage;231 std::map< std::string,Graph::NodeMap<double> * > nms=mytab.mapstorage->nodemap_storage; 230 232 bool itisvar=(nms.find(ch2var[ polishform[i] ])!=nms.end()); 231 233 if(itisvar) 232 234 { 233 polishstack.push( (*(mytab.mapstorage .nodemap_storage[ ch2var[ polishform[i] ] ]))[k]);235 polishstack.push( (*(mytab.mapstorage->nodemap_storage[ ch2var[ polishform[i] ] ]))[k]); 234 236 } 235 237 else … … 269 271 //if addition was not successful addNodeMap returns one. 270 272 //cause can be that there is already a map named like the new one 271 if(mytab.mapstorage .addNodeMap(mapname,emptr, def_val))273 if(mytab.mapstorage->addNodeMap(mapname,emptr, def_val)) 272 274 { 273 275 abortion=1; … … 480 482 if(itisedge) 481 483 { 482 cancel=(mytab.mapstorage .edgemap_storage.find(variable)==mytab.mapstorage.edgemap_storage.end());484 cancel=(mytab.mapstorage->edgemap_storage.find(variable)==mytab.mapstorage->edgemap_storage.end()); 483 485 } 484 486 else 485 487 { 486 cancel=(mytab.mapstorage .nodemap_storage.find(variable)==mytab.mapstorage.nodemap_storage.end());488 cancel=(mytab.mapstorage->nodemap_storage.find(variable)==mytab.mapstorage->nodemap_storage.end()); 487 489 } 488 490 //maybe it is number -
new_map_win.h
r174 r194 20 20 #define NEWMAPWIN_H 21 21 22 class NewMapWin;23 24 22 #include <all_include.h> 25 #include <nbtab.h>26 23 #include <libgnomecanvasmm.h> 27 24 #include <libgnomecanvasmm/polygon.h> 28 25 #include <stack> 26 27 class NoteBookTab; 29 28 30 29 ///Graphical interface for node/edge map creation.
Note: See TracChangeset
for help on using the changeset viewer.