mapstorage.cc
branchgui
changeset 94 adfdc2f70548
parent 79 e6619f95c97e
child 98 f60f89147531
     1.1 --- a/mapstorage.cc	Wed Nov 23 16:24:59 2005 +0000
     1.2 +++ b/mapstorage.cc	Tue Nov 29 19:31:58 2005 +0000
     1.3 @@ -16,6 +16,18 @@
     1.4  
     1.5    nodemap_default["id"] = 1.0;
     1.6    edgemap_default["id"] = 1.0;
     1.7 +
     1.8 +  active_nodemaps.resize(NODE_PROPERTY_NUM);
     1.9 +  for(int i=0;i<NODE_PROPERTY_NUM;i++)
    1.10 +    {
    1.11 +      active_nodemaps[i]="";
    1.12 +    }
    1.13 +
    1.14 +  active_edgemaps.resize(EDGE_PROPERTY_NUM);
    1.15 +  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
    1.16 +    {
    1.17 +      active_edgemaps[i]="";
    1.18 +    }
    1.19  }
    1.20  
    1.21  MapStorage::~MapStorage()
    1.22 @@ -44,6 +56,62 @@
    1.23    return 1;
    1.24  }
    1.25  
    1.26 +void MapStorage::changeActiveMap(bool itisedge, int prop, std::string mapname)
    1.27 +{
    1.28 +  if(itisedge)
    1.29 +    {
    1.30 +      active_edgemaps[prop]=mapname;
    1.31 +    }
    1.32 +  else
    1.33 +    {
    1.34 +      active_nodemaps[prop]=mapname;
    1.35 +    }
    1.36 +  signal_prop.emit(itisedge, prop);
    1.37 +}
    1.38 +
    1.39 +std::string MapStorage::getActiveEdgeMap(int prop)
    1.40 +{
    1.41 +  return active_edgemaps[prop];
    1.42 +}
    1.43 +
    1.44 +std::string MapStorage::getActiveNodeMap(int prop)
    1.45 +{
    1.46 +  return active_nodemaps[prop];
    1.47 +}
    1.48 +
    1.49 +std::vector<std::string> MapStorage::getEdgeMapList()
    1.50 +{
    1.51 +  std::vector<std::string> eml;
    1.52 +  eml.resize(edgemap_storage.size());
    1.53 +  int i=0;
    1.54 +  std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=beginOfEdgeMaps();
    1.55 +  for(;emsi!=endOfEdgeMaps();emsi++)
    1.56 +    {
    1.57 +      eml[i]=(emsi->first);
    1.58 +      i++;
    1.59 +    }
    1.60 +  return eml;
    1.61 +}
    1.62 +
    1.63 +std::vector<std::string> MapStorage::getNodeMapList()
    1.64 +{
    1.65 +  std::vector<std::string> nml;
    1.66 +  nml.resize(nodemap_storage.size());
    1.67 +  int i=0;
    1.68 +  std::map< std::string,Graph::NodeMap<double> * >::iterator nmsi=beginOfNodeMaps();
    1.69 +  for(;nmsi!=endOfNodeMaps();nmsi++)
    1.70 +    {
    1.71 +      nml[i]=(nmsi->first);
    1.72 +      i++;
    1.73 +    }
    1.74 +  return nml;
    1.75 +}
    1.76 +
    1.77 +MapStorage::Signal_Prop MapStorage::signal_prop_ch()
    1.78 +{
    1.79 +  return signal_prop;
    1.80 +}
    1.81 +
    1.82  int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap, double default_value = 0.0)
    1.83  {
    1.84    if( edgemap_storage.find(name) == edgemap_storage.end() )