gui/xymap.h
author deba
Wed, 01 Mar 2006 10:25:30 +0000
changeset 1991 d7442141d9ef
parent 1606 dc4ea2010dee
permissions -rw-r--r--
The graph adadptors can be alteration observed.
In most cases it uses the adapted graph alteration notifiers.
Only special case is now the UndirGraphAdaptor, where
we have to proxy the signals from the graph.

The SubBidirGraphAdaptor is removed, because it doest not
gives more feature than the EdgeSubGraphAdaptor<UndirGraphAdaptor<Graph>>.

The ResGraphAdaptor is based on this composition.
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