gui/mapstorage.h
author athos
Tue, 28 Jun 2005 13:47:16 +0000
changeset 1521 5815b382421b
parent 1442 1e3c69aa035b
child 1523 144ab0e4b09c
permissions -rw-r--r--
Some modifications.
ladanyi@1442
     1
// -*- C++ -*- //
ladanyi@1442
     2
ladanyi@1442
     3
#ifndef MAPSTORAGE_H
ladanyi@1442
     4
#define MAPSTORAGE_H
ladanyi@1442
     5
ladanyi@1442
     6
#include <all_include.h>
ladanyi@1442
     7
ladanyi@1442
     8
///Class MapStorage is responsible for storing
ladanyi@1442
     9
///NodeMaps and EdgeMaps that can be shown later
ladanyi@1442
    10
///on GUI. Therefore maps can be added to it,
ladanyi@1442
    11
///and datas over the added maps can be queried.
ladanyi@1442
    12
///The maps will be stored in an std::map,
ladanyi@1442
    13
///referenced with their names. Unfortunately at
ladanyi@1442
    14
///the moment it works only with double type maps
ladanyi@1442
    15
///
ladanyi@1442
    16
///\todo too many things are public!!
ladanyi@1442
    17
class MapStorage
ladanyi@1442
    18
{
ladanyi@1442
    19
public:
ladanyi@1442
    20
ladanyi@1442
    21
  Graph g;
ladanyi@1442
    22
ladanyi@1442
    23
  ///Stores double type NodeMaps
ladanyi@1442
    24
  std::map< std::string,Graph::NodeMap<double> * > nodemap_storage;
ladanyi@1442
    25
ladanyi@1442
    26
  ///Stores double type EdgeMaps
ladanyi@1442
    27
  std::map< std::string,Graph::EdgeMap<double> * > edgemap_storage;
ladanyi@1442
    28
ladanyi@1442
    29
  //Stores the default values for the different visualization node attributes
ladanyi@1442
    30
  std::vector<Graph::NodeMap<double> > default_nodemaps;
ladanyi@1442
    31
ladanyi@1442
    32
  //Stores the default values for the different visualization edge attributes
ladanyi@1442
    33
  std::vector<Graph::EdgeMap<double> > default_edgemaps;
ladanyi@1442
    34
ladanyi@1442
    35
public:
ladanyi@1442
    36
  ///Constructor of MapStorage. Expects the Graph of
ladanyi@1442
    37
  ///which maps will be stored in it.
ladanyi@1442
    38
  ///Its all activity is initializing default values
ladanyi@1442
    39
  ///for different visualization attributes
ladanyi@1442
    40
  ///
ladanyi@1442
    41
  ///\param graph is the graph for which the maps are stored in this object.
ladanyi@1442
    42
  MapStorage(Graph &);
ladanyi@1442
    43
ladanyi@1442
    44
  ///Adds given map to storage. A name and the map itself has to be provided.
ladanyi@1442
    45
  ///\param name is the name of map
ladanyi@1442
    46
  ///\nodemap is the pointer of the given nodemap
ladanyi@1442
    47
  ///\todo map should be given by reference!
ladanyi@1442
    48
  int addNodeMap(const std::string &,Graph::NodeMap<double> *);
ladanyi@1442
    49
ladanyi@1442
    50
  ///Adds given map to storage. A name and the map itself has to be provided.
ladanyi@1442
    51
  ///\param name is the name of map
ladanyi@1442
    52
  ///\edgemap is the pointer of the given edgemap
ladanyi@1442
    53
  ///\todo map should be given by reference!
ladanyi@1442
    54
  int addEdgeMap(const std::string &,Graph::EdgeMap<double> *);
ladanyi@1442
    55
ladanyi@1442
    56
  ///Returns how much nodemaps is stored in \ref MapStorage
ladanyi@1442
    57
  int numOfNodeMaps() {return nodemap_storage.size();};
ladanyi@1442
    58
ladanyi@1442
    59
  ///Returns how much edgemaps is stored in \ref MapStorage
ladanyi@1442
    60
  int numOfEdgeMaps() {return edgemap_storage.size();};
ladanyi@1442
    61
ladanyi@1442
    62
  ///Returns the maximum value of the given NodeMap. NodeMap has to be given by its name.
ladanyi@1442
    63
  ///\param name is the name of map of which maximum is searched
ladanyi@1442
    64
  double maxOfNodeMap(const std::string &);
ladanyi@1442
    65
ladanyi@1442
    66
  ///Returns the maximum value of the given EdgeMap. EdgeMap has to be given by its name.
ladanyi@1442
    67
  ///\param name is the name of map of which maximum is searched
ladanyi@1442
    68
  double maxOfEdgeMap(const std::string &);
ladanyi@1442
    69
ladanyi@1442
    70
  ///Returns the minimum value of the given NodeMap. NodeMap has to be given by its name.
ladanyi@1442
    71
  ///\param name is the name of map of which minimum is searched
ladanyi@1442
    72
  double minOfNodeMap(const std::string &);
ladanyi@1442
    73
ladanyi@1442
    74
  ///Returns the minimum value of the given EdgeMap. EdgeMap has to be given by its name.
ladanyi@1442
    75
  ///\param name is the name of map of which minimum is searched
ladanyi@1442
    76
  double minOfEdgeMap(const std::string &);
ladanyi@1442
    77
ladanyi@1442
    78
  ///To be able to iterate through each maps this function returns an iterator pointing to the first nodemap in the storage.
ladanyi@1442
    79
  std::map< std::string,Graph::NodeMap<double> * >::iterator beginOfNodeMaps(){return nodemap_storage.begin();};
ladanyi@1442
    80
ladanyi@1442
    81
  ///To be able to iterate through each maps this function returns an iterator pointing to the first edgemap in the storage.
ladanyi@1442
    82
  std::map< std::string,Graph::EdgeMap<double> * >::iterator beginOfEdgeMaps(){return edgemap_storage.begin();};
hegyi@1509
    83
hegyi@1509
    84
  ///This function sets a default base value for the newly created node
hegyi@1509
    85
  void init_maps_for_node(NodeIt);
hegyi@1509
    86
hegyi@1509
    87
  ///This function sets a default base value for the newly created node
hegyi@1509
    88
  void init_maps_for_edge(Graph::Edge);
ladanyi@1442
    89
};
ladanyi@1442
    90
ladanyi@1442
    91
#endif //MAPSTORAGE_H