gui/xymap.h
author ladanyi
Sun, 29 Jan 2006 22:06:45 +0000
changeset 1919 9704601de87f
parent 1606 dc4ea2010dee
permissions -rw-r--r--
demo for simann
ladanyi@1606
     1
#ifndef XYMAP_H
ladanyi@1606
     2
#define XYMAP_H
ladanyi@1606
     3
ladanyi@1606
     4
#include <lemon/list_graph.h>
ladanyi@1606
     5
#include <lemon/xy.h>
ladanyi@1606
     6
ladanyi@1606
     7
template<class M>
ladanyi@1606
     8
class XYMap
ladanyi@1606
     9
{
ladanyi@1606
    10
  private:
ladanyi@1606
    11
    M *xmap, *ymap;
ladanyi@1606
    12
ladanyi@1606
    13
  public:
ladanyi@1606
    14
    typedef typename M::Key Key;
ladanyi@1860
    15
    typedef lemon::xy<typename M::Value> Value;
ladanyi@1606
    16
    XYMap() {}
ladanyi@1606
    17
    XYMap(M &_xmap, M &_ymap) : xmap(&_xmap), ymap(&_ymap) {}
ladanyi@1606
    18
    void setXMap(M &_xmap) { xmap = &_xmap; }
ladanyi@1606
    19
    void setYMap(M &_ymap) { ymap = &_ymap; }
ladanyi@1606
    20
    Value operator[](Key k) const
ladanyi@1606
    21
    {
ladanyi@1606
    22
      Value v(xmap->operator[](k), ymap->operator[](k));
ladanyi@1606
    23
      return v;
ladanyi@1606
    24
    }
ladanyi@1606
    25
    void set(Key k, Value v)
ladanyi@1606
    26
    {
ladanyi@1606
    27
      xmap->set(k, v.x);
ladanyi@1606
    28
      ymap->set(k, v.y);
ladanyi@1606
    29
    }
ladanyi@1606
    30
};
ladanyi@1606
    31
ladanyi@1606
    32
#endif