xymap.h
author hegyi
Thu, 05 Jan 2006 12:30:09 +0000
branchgui
changeset 108 bf355fd6563e
parent 53 e73d7540bd24
child 150 86273bfe0e4d
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.
     1 #ifndef XYMAP_H
     2 #define XYMAP_H
     3 
     4 #include <lemon/list_graph.h>
     5 #include <lemon/xy.h>
     6 
     7 template<class M>
     8 class 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