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