26 isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""), |
26 isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""), |
27 edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), edge_width(10), |
27 edgemap_to_edit(""), autoscale(true), zoomtrack(false), radius_size(20), edge_width(10), |
28 was_redesigned(false), is_drawn(false), mytab(mainw), |
28 was_redesigned(false), is_drawn(false), mytab(mainw), |
29 background_set(false) |
29 background_set(false) |
30 { |
30 { |
|
31 //add mouse scroll event handler - it won't be changed, it handles zoom |
|
32 signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::scrollEventHandler), false); |
|
33 |
31 //base event handler is move tool |
34 //base event handler is move tool |
32 actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false); |
35 actual_handler=signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::moveEventHandler), false); |
33 actual_tool=MOVE; |
36 actual_tool=MOVE; |
|
37 |
34 |
38 |
35 active_node=INVALID; |
39 active_node=INVALID; |
36 active_edge=INVALID; |
40 active_edge=INVALID; |
37 forming_edge=INVALID; |
41 forming_edge=INVALID; |
38 |
42 |
399 actual_forces.set(i,actual_forces[i]-delta); |
404 actual_forces.set(i,actual_forces[i]-delta); |
400 } |
405 } |
401 } |
406 } |
402 for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i) |
407 for (NodeIt i((mytab.mapstorage).graph); i!=INVALID; ++i) |
403 { |
408 { |
|
409 if(((mytab.mapstorage).coords[i].x)+actual_forces[i].x>max_coord) |
|
410 { |
|
411 actual_forces[i].x=max_coord-((mytab.mapstorage).coords[i].x); |
|
412 std::cout << "Correction! " << (((mytab.mapstorage).coords[i].x)+actual_forces[i].x) << std::endl; |
|
413 } |
|
414 else if(((mytab.mapstorage).coords[i].x)+actual_forces[i].x<(0-max_coord)) |
|
415 { |
|
416 actual_forces[i].x=0-max_coord-((mytab.mapstorage).coords[i].x); |
|
417 std::cout << "Correction! " << (((mytab.mapstorage).coords[i].x)+actual_forces[i].x) << std::endl; |
|
418 } |
|
419 if(((mytab.mapstorage).coords[i].y)+actual_forces[i].y>max_coord) |
|
420 { |
|
421 actual_forces[i].y=max_coord-((mytab.mapstorage).coords[i].y); |
|
422 std::cout << "Correction! " << (((mytab.mapstorage).coords[i].y)+actual_forces[i].y) << std::endl; |
|
423 } |
|
424 else if(((mytab.mapstorage).coords[i].y)+actual_forces[i].y<(0-max_coord)) |
|
425 { |
|
426 actual_forces[i].y=0-max_coord-((mytab.mapstorage).coords[i].y); |
|
427 std::cout << "Correction! " << (((mytab.mapstorage).coords[i].y)+actual_forces[i].y) << std::endl; |
|
428 } |
404 moveNode(actual_forces[i].x, actual_forces[i].y, nodesmap[i], i); |
429 moveNode(actual_forces[i].x, actual_forces[i].y, nodesmap[i], i); |
405 } |
430 } |
406 } |
431 } |
407 } |
432 } |
408 |
433 |