1 #include <mapstorage.h>
3 MapStorage::MapStorage(Graph & graph):g(graph)
5 for(int i=0;i<PROPERTY_NUM;i++)
7 Graph::EdgeMap<double> emd(g);
8 default_edgemaps.push_back(emd);
9 Graph::NodeMap<double> nmd(g);
10 default_nodemaps.push_back(nmd);
12 for(int i=0;i<PROPERTY_NUM;i++)
14 for (EdgeIt j(g); j!=INVALID; ++j)
16 (default_edgemaps[i])[j]=property_defaults[i];
18 addEdgeMap(property_strings[i],&(default_edgemaps[i]));
23 int MapStorage::addNodeMap(const std::string & name, Graph::NodeMap<double> *nodemap)
25 nodemap_storage[name]=nodemap;
29 int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap)
31 edgemap_storage[name]=edgemap;
35 double MapStorage::maxOfNodeMap(const std::string & name)
38 for (NodeIt j(g); j!=INVALID; ++j)
40 if( (*nodemap_storage[name])[j]>max )
42 max=(*nodemap_storage[name])[j];
48 double MapStorage::maxOfEdgeMap(const std::string & name)
51 for (EdgeIt j(g); j!=INVALID; ++j)
53 if( (*edgemap_storage[name])[j]>max )
55 max=(*edgemap_storage[name])[j];
61 double MapStorage::minOfNodeMap(const std::string & name)
64 double min=(*nodemap_storage[name])[j];
65 for (; j!=INVALID; ++j)
67 if( (*nodemap_storage[name])[j]<min )
69 min=(*nodemap_storage[name])[j];
75 double MapStorage::minOfEdgeMap(const std::string & name)
78 double min=(*edgemap_storage[name])[j];
79 for (EdgeIt j(g); j!=INVALID; ++j)
81 if( (*edgemap_storage[name])[j]<min )
83 min=(*edgemap_storage[name])[j];