graph_displayer_canvas-event.cc
branchgui
changeset 80 231191361de5
parent 70 2ee22e690853
child 87 b44281e4cca7
equal deleted inserted replaced
26:dc21f95d51c6 27:baef0345aa90
   157         // reposition the coordinates text
   157         // reposition the coordinates text
   158         std::ostringstream ostr;
   158         std::ostringstream ostr;
   159         ostr << "(" <<
   159         ostr << "(" <<
   160           mapstorage.coords[active_node].x << ", " <<
   160           mapstorage.coords[active_node].x << ", " <<
   161           mapstorage.coords[active_node].y << ")";
   161           mapstorage.coords[active_node].y << ")";
       
   162         double radius =
       
   163           (nodesmap[active_node]->property_x2().get_value() -
       
   164           nodesmap[active_node]->property_x1().get_value()) / 2.0;
   162         if (coord_text)
   165         if (coord_text)
   163         {
   166         {
   164           coord_text->property_text().set_value(ostr.str());
   167           coord_text->property_text().set_value(ostr.str());
   165           coord_text->property_x().set_value(mapstorage.coords[active_node].x +
   168           coord_text->property_x().set_value(mapstorage.coords[active_node].x +
   166               node_property_defaults[N_RADIUS] + 40);
   169               radius);
   167           coord_text->property_y().set_value(mapstorage.coords[active_node].y +
   170           coord_text->property_y().set_value(mapstorage.coords[active_node].y -
   168               node_property_defaults[N_RADIUS] - 40);
   171               radius);
   169         }
   172         }
   170         else
   173         else
   171         {
   174         {
   172           coord_text = new Gnome::Canvas::Text(
   175           coord_text = new Gnome::Canvas::Text(
   173               displayed_graph,
   176               displayed_graph,
   174               mapstorage.coords[active_node].x +
   177               mapstorage.coords[active_node].x + radius,
   175               node_property_defaults[N_RADIUS] + 40,
   178               mapstorage.coords[active_node].y - radius,
   176               mapstorage.coords[active_node].y +
       
   177               node_property_defaults[N_RADIUS] - 40,
       
   178               ostr.str());
   179               ostr.str());
   179           coord_text->property_fill_color().set_value("black");
   180           coord_text->property_fill_color().set_value("black");
       
   181           coord_text->property_anchor().set_value(Gtk::ANCHOR_SOUTH_WEST);
   180         }
   182         }
   181 
   183 
   182 	//all the edges connected to the moved point has to be redrawn
   184 	//all the edges connected to the moved point has to be redrawn
   183         for(OutEdgeIt ei(mapstorage.graph,active_node);ei!=INVALID;++ei)
   185         for(OutEdgeIt ei(mapstorage.graph,active_node);ei!=INVALID;++ei)
   184         {
   186         {