gui/xymap.h
author hegyi
Mon, 21 Nov 2005 18:03:20 +0000
changeset 1823 cb082cdf3667
child 1860 27a9a75b957b
permissions -rw-r--r--
NewMapWin has become Dialog instead of Window. Therefore it is created dynamically, when there is need for it, instead of keeping one instance in memory. This solution is slower, but more correct than before.
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
using lemon::ListGraph;
ladanyi@1606
     8
using lemon::xy;
ladanyi@1606
     9
ladanyi@1606
    10
template<class M>
ladanyi@1606
    11
class XYMap
ladanyi@1606
    12
{
ladanyi@1606
    13
  private:
ladanyi@1606
    14
    M *xmap, *ymap;
ladanyi@1606
    15
ladanyi@1606
    16
  public:
ladanyi@1606
    17
    typedef typename M::Key Key;
ladanyi@1606
    18
    typedef xy<typename M::Value> Value;
ladanyi@1606
    19
    XYMap() {}
ladanyi@1606
    20
    XYMap(M &_xmap, M &_ymap) : xmap(&_xmap), ymap(&_ymap) {}
ladanyi@1606
    21
    void setXMap(M &_xmap) { xmap = &_xmap; }
ladanyi@1606
    22
    void setYMap(M &_ymap) { ymap = &_ymap; }
ladanyi@1606
    23
    Value operator[](Key k) const
ladanyi@1606
    24
    {
ladanyi@1606
    25
      Value v(xmap->operator[](k), ymap->operator[](k));
ladanyi@1606
    26
      return v;
ladanyi@1606
    27
    }
ladanyi@1606
    28
    void set(Key k, Value v)
ladanyi@1606
    29
    {
ladanyi@1606
    30
      xmap->set(k, v.x);
ladanyi@1606
    31
      ymap->set(k, v.y);
ladanyi@1606
    32
    }
ladanyi@1606
    33
};
ladanyi@1606
    34
ladanyi@1606
    35
#endif