gui/xymap.h
author hegyi
Thu, 05 Jan 2006 12:30:09 +0000
changeset 1878 409a31271efd
parent 1606 dc4ea2010dee
permissions -rw-r--r--
Several changes. \n If new map is added to mapstorage it emits signal with the name of the new map. This was important, because from now on not only tha mapwin should be updated. \n Furthermore algobox gets a pointer to mapstorage instead of only the mapnames from it. This is important because without it it would be complicated to pass all of the required maps to algobox.
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