Changeset 150:86273bfe0e4d in glemon-0.x for graph_displayer_canvas-event.cc
- Timestamp:
- 09/21/06 12:29:29 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@2951
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
graph_displayer_canvas-event.cc
r149 r150 135 135 136 136 // write back the new coordinates to the coords map 137 (mytab.mapstorage).coords.set(active_node, xy<double>(coord_x, coord_y));137 (mytab.mapstorage).coords.set(active_node, XY(coord_x, coord_y)); 138 138 139 139 clicked_x=new_x; … … 235 235 236 236 //old vector from one to the other node - a 237 xy<double>a_v(moved_node_1.x-fix_node.x,moved_node_1.y-fix_node.y);237 XY a_v(moved_node_1.x-fix_node.x,moved_node_1.y-fix_node.y); 238 238 //new vector from one to the other node - b 239 xy<double>b_v(moved_node_2.x-fix_node.x,moved_node_2.y-fix_node.y);239 XY b_v(moved_node_2.x-fix_node.x,moved_node_2.y-fix_node.y); 240 240 241 241 double absa=sqrt(a_v.normSquare()); … … 249 249 { 250 250 //old vector from one node to the breakpoint - c 251 xy<double>c_v(old_arrow_pos.x-fix_node.x,old_arrow_pos.y-fix_node.y);251 XY c_v(old_arrow_pos.x-fix_node.x,old_arrow_pos.y-fix_node.y); 252 252 253 253 //unit vector with the same direction to a_v 254 xy<double>a_v_u(a_v.x/absa,a_v.y/absa);254 XY a_v_u(a_v.x/absa,a_v.y/absa); 255 255 256 256 //normal vector of unit vector with the same direction to a_v 257 xy<double>a_v_u_n(((-1)*a_v_u.y),a_v_u.x);257 XY a_v_u_n(((-1)*a_v_u.y),a_v_u.x); 258 258 259 259 //unit vector with the same direction to b_v 260 xy<double>b_v_u(b_v.x/absb,b_v.y/absb);260 XY b_v_u(b_v.x/absb,b_v.y/absb); 261 261 262 262 //normal vector of unit vector with the same direction to b_v 263 xy<double>b_v_u_n(((-1)*b_v_u.y),b_v_u.x);263 XY b_v_u_n(((-1)*b_v_u.y),b_v_u.x); 264 264 265 265 //vector c in a_v_u and a_v_u_n co-ordinate system 266 xy<double>c_a(c_v*a_v_u,c_v*a_v_u_n);266 XY c_a(c_v*a_v_u,c_v*a_v_u_n); 267 267 268 268 //new vector from one node to the breakpoint - d - we have to calculate this one 269 xy<double>d_v=absb/absa*(c_a.x*b_v_u+c_a.y*b_v_u_n);269 XY d_v=absb/absa*(c_a.x*b_v_u+c_a.y*b_v_u_n); 270 270 271 271 return XY(d_v.x+fix_node.x,d_v.y+fix_node.y); … … 306 306 307 307 // update coordinates 308 (mytab.mapstorage).coords.set(active_node, xy<double>(clicked_x, clicked_y));308 (mytab.mapstorage).coords.set(active_node, XY(clicked_x, clicked_y)); 309 309 310 310 // update all other maps … … 791 791 } 792 792 793 void GraphDisplayerCanvas::textReposition( xy<double>new_place)794 { 795 new_place+=( xy<double>(10,10));793 void GraphDisplayerCanvas::textReposition(XY new_place) 794 { 795 new_place+=(XY(10,10)); 796 796 edgetextmap[forming_edge]->property_x().set_value(new_place.x); 797 797 edgetextmap[forming_edge]->property_y().set_value(new_place.y);
Note: See TracChangeset
for help on using the changeset viewer.