1.1 --- a/gui/mapstorage.cc Wed Jun 01 23:30:13 2005 +0000
1.2 +++ b/gui/mapstorage.cc Wed Jun 01 23:33:26 2005 +0000
1.3 @@ -1,88 +1,88 @@
1.4 -#include <mapstorage.h>
1.5 -
1.6 -MapStorage::MapStorage(Graph & graph):g(graph)
1.7 -{
1.8 - for(int i=0;i<PROPERTY_NUM;i++)
1.9 - {
1.10 - Graph::EdgeMap<double> emd(g);
1.11 - default_edgemaps.push_back(emd);
1.12 - Graph::NodeMap<double> nmd(g);
1.13 - default_nodemaps.push_back(nmd);
1.14 - }
1.15 - for(int i=0;i<PROPERTY_NUM;i++)
1.16 - {
1.17 - for (EdgeIt j(g); j!=INVALID; ++j)
1.18 - {
1.19 - (default_edgemaps[i])[j]=property_defaults[i];
1.20 - }
1.21 - addEdgeMap(property_strings[i],&(default_edgemaps[i]));
1.22 - }
1.23 -
1.24 -};
1.25 -
1.26 -int MapStorage::addNodeMap(const std::string & name, Graph::NodeMap<double> *nodemap)
1.27 -{
1.28 - nodemap_storage[name]=nodemap;
1.29 - return 0;
1.30 -}
1.31 -
1.32 -int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap)
1.33 -{
1.34 - edgemap_storage[name]=edgemap;
1.35 - return 0;
1.36 -}
1.37 -
1.38 -double MapStorage::maxOfNodeMap(const std::string & name)
1.39 -{
1.40 - double max=0;
1.41 - for (NodeIt j(g); j!=INVALID; ++j)
1.42 - {
1.43 - if( (*nodemap_storage[name])[j]>max )
1.44 - {
1.45 - max=(*nodemap_storage[name])[j];
1.46 - }
1.47 - }
1.48 - return max;
1.49 -}
1.50 -
1.51 -double MapStorage::maxOfEdgeMap(const std::string & name)
1.52 -{
1.53 - double max=0;
1.54 - for (EdgeIt j(g); j!=INVALID; ++j)
1.55 - {
1.56 - if( (*edgemap_storage[name])[j]>max )
1.57 - {
1.58 - max=(*edgemap_storage[name])[j];
1.59 - }
1.60 - }
1.61 - return max;
1.62 -}
1.63 -
1.64 -double MapStorage::minOfNodeMap(const std::string & name)
1.65 -{
1.66 - NodeIt j(g);
1.67 - double min=(*nodemap_storage[name])[j];
1.68 - for (; j!=INVALID; ++j)
1.69 - {
1.70 - if( (*nodemap_storage[name])[j]<min )
1.71 - {
1.72 - min=(*nodemap_storage[name])[j];
1.73 - }
1.74 - }
1.75 - return min;
1.76 -}
1.77 -
1.78 -double MapStorage::minOfEdgeMap(const std::string & name)
1.79 -{
1.80 - EdgeIt j(g);
1.81 - double min=(*edgemap_storage[name])[j];
1.82 - for (EdgeIt j(g); j!=INVALID; ++j)
1.83 - {
1.84 - if( (*edgemap_storage[name])[j]<min )
1.85 - {
1.86 - min=(*edgemap_storage[name])[j];
1.87 - }
1.88 - }
1.89 - return min;
1.90 -}
1.91 -
1.92 +#include <mapstorage.h>
1.93 +
1.94 +MapStorage::MapStorage(Graph & graph):g(graph)
1.95 +{
1.96 + for(int i=0;i<PROPERTY_NUM;i++)
1.97 + {
1.98 + Graph::EdgeMap<double> emd(g);
1.99 + default_edgemaps.push_back(emd);
1.100 + Graph::NodeMap<double> nmd(g);
1.101 + default_nodemaps.push_back(nmd);
1.102 + }
1.103 + for(int i=0;i<PROPERTY_NUM;i++)
1.104 + {
1.105 + for (EdgeIt j(g); j!=INVALID; ++j)
1.106 + {
1.107 + (default_edgemaps[i])[j]=property_defaults[i];
1.108 + }
1.109 + addEdgeMap(property_strings[i],&(default_edgemaps[i]));
1.110 + }
1.111 +
1.112 +};
1.113 +
1.114 +int MapStorage::addNodeMap(const std::string & name, Graph::NodeMap<double> *nodemap)
1.115 +{
1.116 + nodemap_storage[name]=nodemap;
1.117 + return 0;
1.118 +}
1.119 +
1.120 +int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap)
1.121 +{
1.122 + edgemap_storage[name]=edgemap;
1.123 + return 0;
1.124 +}
1.125 +
1.126 +double MapStorage::maxOfNodeMap(const std::string & name)
1.127 +{
1.128 + double max=0;
1.129 + for (NodeIt j(g); j!=INVALID; ++j)
1.130 + {
1.131 + if( (*nodemap_storage[name])[j]>max )
1.132 + {
1.133 + max=(*nodemap_storage[name])[j];
1.134 + }
1.135 + }
1.136 + return max;
1.137 +}
1.138 +
1.139 +double MapStorage::maxOfEdgeMap(const std::string & name)
1.140 +{
1.141 + double max=0;
1.142 + for (EdgeIt j(g); j!=INVALID; ++j)
1.143 + {
1.144 + if( (*edgemap_storage[name])[j]>max )
1.145 + {
1.146 + max=(*edgemap_storage[name])[j];
1.147 + }
1.148 + }
1.149 + return max;
1.150 +}
1.151 +
1.152 +double MapStorage::minOfNodeMap(const std::string & name)
1.153 +{
1.154 + NodeIt j(g);
1.155 + double min=(*nodemap_storage[name])[j];
1.156 + for (; j!=INVALID; ++j)
1.157 + {
1.158 + if( (*nodemap_storage[name])[j]<min )
1.159 + {
1.160 + min=(*nodemap_storage[name])[j];
1.161 + }
1.162 + }
1.163 + return min;
1.164 +}
1.165 +
1.166 +double MapStorage::minOfEdgeMap(const std::string & name)
1.167 +{
1.168 + EdgeIt j(g);
1.169 + double min=(*edgemap_storage[name])[j];
1.170 + for (EdgeIt j(g); j!=INVALID; ++j)
1.171 + {
1.172 + if( (*edgemap_storage[name])[j]<min )
1.173 + {
1.174 + min=(*edgemap_storage[name])[j];
1.175 + }
1.176 + }
1.177 + return min;
1.178 +}
1.179 +