COIN-OR::LEMON - Graph Library

source: lemon-0.x/gui/xymap.h @ 2071:00c4ce4f4170

Last change on this file since 2071:00c4ce4f4170 was 1860:27a9a75b957b, checked in by Akos Ladanyi, 14 years ago

Save and load the coordinates of the arrows on the edges.

File size: 631 bytes
Line 
1#ifndef XYMAP_H
2#define XYMAP_H
3
4#include <lemon/list_graph.h>
5#include <lemon/xy.h>
6
7template<class M>
8class XYMap
9{
10  private:
11    M *xmap, *ymap;
12
13  public:
14    typedef typename M::Key Key;
15    typedef lemon::xy<typename M::Value> Value;
16    XYMap() {}
17    XYMap(M &_xmap, M &_ymap) : xmap(&_xmap), ymap(&_ymap) {}
18    void setXMap(M &_xmap) { xmap = &_xmap; }
19    void setYMap(M &_ymap) { ymap = &_ymap; }
20    Value operator[](Key k) const
21    {
22      Value v(xmap->operator[](k), ymap->operator[](k));
23      return v;
24    }
25    void set(Key k, Value v)
26    {
27      xmap->set(k, v.x);
28      ymap->set(k, v.y);
29    }
30};
31
32#endif
Note: See TracBrowser for help on using the repository browser.