EdgeMap and NodeMap creation is done, at last. Bach 4ever.
1 #include <mapstorage.h>
3 MapStorage::MapStorage(Graph & graph):g(graph)
7 int MapStorage::addNodeMap(const std::string & name, Graph::NodeMap<double> *nodemap)
9 nodemap_storage[name]=nodemap;
13 int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap)
15 edgemap_storage[name]=edgemap;
19 double MapStorage::maxOfNodeMap(const std::string & name)
22 for (NodeIt j(g); j!=INVALID; ++j)
24 if( (*nodemap_storage[name])[j]>max )
26 max=(*nodemap_storage[name])[j];
32 double MapStorage::maxOfEdgeMap(const std::string & name)
35 for (EdgeIt j(g); j!=INVALID; ++j)
37 if( (*edgemap_storage[name])[j]>max )
39 max=(*edgemap_storage[name])[j];
45 double MapStorage::minOfNodeMap(const std::string & name)
48 double min=(*nodemap_storage[name])[j];
49 for (; j!=INVALID; ++j)
51 if( (*nodemap_storage[name])[j]<min )
53 min=(*nodemap_storage[name])[j];
59 double MapStorage::minOfEdgeMap(const std::string & name)
62 double min=(*edgemap_storage[name])[j];
63 for (EdgeIt j(g); j!=INVALID; ++j)
65 if( (*edgemap_storage[name])[j]<min )
67 min=(*edgemap_storage[name])[j];
73 void MapStorage::initMapsForEdge(Graph::Edge e)
75 std::map< std::string,Graph::EdgeMap<double> * >::iterator ems_it;
76 for(ems_it=edgemap_storage.begin();ems_it!=edgemap_storage.end();ems_it++)
78 (*((*ems_it).second))[e]=5;