author | alpar |
Thu, 28 Jul 2005 19:05:45 +0000 | |
changeset 1604 | 4d037c2b66aa |
parent 1525 | 6d94de269ab1 |
child 1606 | dc4ea2010dee |
permissions | -rw-r--r-- |
ladanyi@1442 | 1 |
#include <mapstorage.h> |
ladanyi@1442 | 2 |
|
ladanyi@1442 | 3 |
MapStorage::MapStorage(Graph & graph):g(graph) |
ladanyi@1442 | 4 |
{ |
ladanyi@1442 | 5 |
}; |
ladanyi@1442 | 6 |
|
ladanyi@1442 | 7 |
int MapStorage::addNodeMap(const std::string & name, Graph::NodeMap<double> *nodemap) |
ladanyi@1442 | 8 |
{ |
hegyi@1597 | 9 |
if( nodemap_storage.find(name) == nodemap_storage.end() ) |
hegyi@1597 | 10 |
{ |
hegyi@1597 | 11 |
nodemap_storage[name]=nodemap; |
hegyi@1597 | 12 |
return 0; |
hegyi@1597 | 13 |
} |
hegyi@1597 | 14 |
return 1; |
ladanyi@1442 | 15 |
} |
ladanyi@1442 | 16 |
|
ladanyi@1442 | 17 |
int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap) |
ladanyi@1442 | 18 |
{ |
hegyi@1597 | 19 |
if( edgemap_storage.find(name) == edgemap_storage.end() ) |
hegyi@1597 | 20 |
{ |
hegyi@1597 | 21 |
edgemap_storage[name]=edgemap; |
hegyi@1597 | 22 |
return 0; |
hegyi@1597 | 23 |
} |
hegyi@1597 | 24 |
return 1; |
ladanyi@1442 | 25 |
} |
ladanyi@1442 | 26 |
|
ladanyi@1442 | 27 |
double MapStorage::maxOfNodeMap(const std::string & name) |
ladanyi@1442 | 28 |
{ |
ladanyi@1442 | 29 |
double max=0; |
ladanyi@1442 | 30 |
for (NodeIt j(g); j!=INVALID; ++j) |
ladanyi@1442 | 31 |
{ |
ladanyi@1442 | 32 |
if( (*nodemap_storage[name])[j]>max ) |
ladanyi@1442 | 33 |
{ |
ladanyi@1442 | 34 |
max=(*nodemap_storage[name])[j]; |
ladanyi@1442 | 35 |
} |
ladanyi@1442 | 36 |
} |
ladanyi@1442 | 37 |
return max; |
ladanyi@1442 | 38 |
} |
ladanyi@1442 | 39 |
|
ladanyi@1442 | 40 |
double MapStorage::maxOfEdgeMap(const std::string & name) |
ladanyi@1442 | 41 |
{ |
ladanyi@1442 | 42 |
double max=0; |
ladanyi@1442 | 43 |
for (EdgeIt j(g); j!=INVALID; ++j) |
ladanyi@1442 | 44 |
{ |
ladanyi@1442 | 45 |
if( (*edgemap_storage[name])[j]>max ) |
ladanyi@1442 | 46 |
{ |
ladanyi@1442 | 47 |
max=(*edgemap_storage[name])[j]; |
ladanyi@1442 | 48 |
} |
ladanyi@1442 | 49 |
} |
ladanyi@1442 | 50 |
return max; |
ladanyi@1442 | 51 |
} |
ladanyi@1442 | 52 |
|
ladanyi@1442 | 53 |
double MapStorage::minOfNodeMap(const std::string & name) |
ladanyi@1442 | 54 |
{ |
ladanyi@1442 | 55 |
NodeIt j(g); |
ladanyi@1442 | 56 |
double min=(*nodemap_storage[name])[j]; |
ladanyi@1442 | 57 |
for (; j!=INVALID; ++j) |
ladanyi@1442 | 58 |
{ |
ladanyi@1442 | 59 |
if( (*nodemap_storage[name])[j]<min ) |
ladanyi@1442 | 60 |
{ |
ladanyi@1442 | 61 |
min=(*nodemap_storage[name])[j]; |
ladanyi@1442 | 62 |
} |
ladanyi@1442 | 63 |
} |
ladanyi@1442 | 64 |
return min; |
ladanyi@1442 | 65 |
} |
ladanyi@1442 | 66 |
|
ladanyi@1442 | 67 |
double MapStorage::minOfEdgeMap(const std::string & name) |
ladanyi@1442 | 68 |
{ |
ladanyi@1442 | 69 |
EdgeIt j(g); |
ladanyi@1442 | 70 |
double min=(*edgemap_storage[name])[j]; |
ladanyi@1442 | 71 |
for (EdgeIt j(g); j!=INVALID; ++j) |
ladanyi@1442 | 72 |
{ |
ladanyi@1442 | 73 |
if( (*edgemap_storage[name])[j]<min ) |
ladanyi@1442 | 74 |
{ |
ladanyi@1442 | 75 |
min=(*edgemap_storage[name])[j]; |
ladanyi@1442 | 76 |
} |
ladanyi@1442 | 77 |
} |
ladanyi@1442 | 78 |
return min; |
ladanyi@1442 | 79 |
} |
ladanyi@1442 | 80 |
|
hegyi@1524 | 81 |
void MapStorage::initMapsForEdge(Graph::Edge e) |
hegyi@1509 | 82 |
{ |
hegyi@1525 | 83 |
std::map< std::string,Graph::EdgeMap<double> * >::iterator ems_it; |
hegyi@1525 | 84 |
for(ems_it=edgemap_storage.begin();ems_it!=edgemap_storage.end();ems_it++) |
hegyi@1525 | 85 |
{ |
hegyi@1525 | 86 |
(*((*ems_it).second))[e]=5; |
hegyi@1525 | 87 |
} |
hegyi@1509 | 88 |
} |