COIN-OR::LEMON - Graph Library

Changeset 150:86273bfe0e4d in glemon-0.x


Ignore:
Timestamp:
09/21/06 12:29:29 (13 years ago)
Author:
Hegyi Péter
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@2951
Message:

According to xy->Point changement.

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • all_include.h

    r149 r150  
    1515#include <lemon/maps.h>
    1616#include <lemon/error.h>
    17 #include <lemon/xy.h>
     17#include <lemon/dim2.h>
    1818
    1919enum {E_WIDTH, E_COLOR, E_TEXT, EDGE_PROPERTY_NUM}; // edge properties;
     
    3838using namespace lemon;
    3939
    40 typedef xy<double> XY;
     40typedef lemon::dim2::Point<double> XY;
    4141typedef ListGraph Graph;
    4242typedef Graph::Node Node;
  • graph_displayer_canvas-event.cc

    r149 r150  
    135135
    136136        // 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));
    138138
    139139        clicked_x=new_x;
     
    235235
    236236        //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);
    238238        //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);
    240240
    241241        double absa=sqrt(a_v.normSquare());
     
    249249          {
    250250            //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);
    252252
    253253            //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);
    255255
    256256            //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);
    258258
    259259            //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);
    261261
    262262            //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);
    264264
    265265            //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);
    267267
    268268            //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);
    270270
    271271            return XY(d_v.x+fix_node.x,d_v.y+fix_node.y);
     
    306306
    307307      // 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));
    309309
    310310      // update all other maps
     
    791791}
    792792
    793 void GraphDisplayerCanvas::textReposition(xy<double> new_place)
    794 {
    795   new_place+=(xy<double>(10,10));
     793void GraphDisplayerCanvas::textReposition(XY new_place)
     794{
     795  new_place+=(XY(10,10));
    796796  edgetextmap[forming_edge]->property_x().set_value(new_place.x);
    797797  edgetextmap[forming_edge]->property_y().set_value(new_place.y);
  • graph_displayer_canvas.cc

    r149 r150  
    200200    //initializing edge-text as well, to empty string
    201201
    202     xy<double> text_pos(
     202    XY text_pos(
    203203        ((mytab.mapstorage).coords[i].x+node_property_defaults[N_RADIUS]+5),
    204204        ((mytab.mapstorage).coords[i].y+node_property_defaults[N_RADIUS]+5));
  • graph_displayer_canvas.h

    r149 r150  
    1010#include <libgnomecanvasmm.h>
    1111#include <libgnomecanvasmm/polygon.h>
    12 #include <lemon/xy.h>
     12#include <lemon/dim2.h>
    1313
    1414///This class is the canvas, on which the graph can be drawn.
     
    269269public:
    270270  ///Moves the text to new place
    271   void textReposition(xy<double>);
     271  void textReposition(XY);
    272272
    273273  ///Activates an edge belonging to an EdgeBase
  • gui_reader.cc

    r134 r150  
    22#include "xml.h"
    33#include "mapstorage.h"
    4 #include <lemon/xy.h>
     4#include <lemon/dim2.h>
    55#include <vector>
    66
     
    1616{
    1717  XmlIo x(is);
    18   std::map<int, xy<double> > m;
     18  std::map<int, XY > m;
    1919  x("arrow_pos", m);
    2020
  • gui_writer.cc

    r134 r150  
    22#include "xml.h"
    33#include "mapstorage.h"
    4 #include <lemon/xy.h>
     4#include <lemon/dim2.h>
    55#include <vector>
    66
     
    1313{
    1414  XmlIo x(os);
    15   std::map<int, xy<double> > m;
     15  std::map<int, XY > m;
    1616  for (EdgeIt e(mapstorage->graph); e != INVALID; ++e)
    1717  {
  • xml.h

    r127 r150  
    2121#include <map>
    2222#include <lemon/error.h>
    23 #include <lemon/xy.h>
     23#include <lemon/dim2.h>
    2424
    2525namespace lemon {
     
    410410  ///
    411411  template<class T>
    412   void xml(XmlIo &x,lemon::xy<T> &v)
     412  void xml(XmlIo &x,lemon::dim2::Point<T> &v)
    413413  {
    414414    { XmlIo::LineTag t(x,"x"); x(v.x); }
     
    421421  ///
    422422  template<class T>
    423   void xml(XmlIo &x,lemon::BoundingBox<T> &v)
     423  void xml(XmlIo &x,lemon::dim2::BoundingBox<T> &v)
    424424  {
    425425    if(x.write()) {
     
    432432      v.clear();
    433433      while(x.nextTag()=="point") {
    434         lemon::xy<T> co;
     434        lemon::dim2::Point<T> co;
    435435        x("point",co);
    436436        v.add(co);
  • xymap.h

    r98 r150  
    33
    44#include <lemon/list_graph.h>
    5 #include <lemon/xy.h>
     5#include <lemon/dim2.h>
    66
    77template<class M>
     
    1313  public:
    1414    typedef typename M::Key Key;
    15     typedef lemon::xy<typename M::Value> Value;
     15    typedef lemon::dim2::Point<typename M::Value> Value;
    1616    XYMap() {}
    1717    XYMap(M &_xmap, M &_ymap) : xmap(&_xmap), ymap(&_ymap) {}
Note: See TracChangeset for help on using the changeset viewer.