ladanyi@1442: // -*- C++ -*- // ladanyi@1442: ladanyi@1442: #ifndef MAPSTORAGE_H ladanyi@1442: #define MAPSTORAGE_H ladanyi@1442: ladanyi@1442: #include ladanyi@1442: ladanyi@1442: ///Class MapStorage is responsible for storing ladanyi@1442: ///NodeMaps and EdgeMaps that can be shown later ladanyi@1442: ///on GUI. Therefore maps can be added to it, ladanyi@1442: ///and datas over the added maps can be queried. ladanyi@1442: ///The maps will be stored in an std::map, ladanyi@1442: ///referenced with their names. Unfortunately at ladanyi@1442: ///the moment it works only with double type maps ladanyi@1442: /// ladanyi@1442: ///\todo too many things are public!! ladanyi@1442: class MapStorage ladanyi@1442: { ladanyi@1442: public: ladanyi@1442: ladanyi@1442: Graph g; ladanyi@1442: ladanyi@1442: ///Stores double type NodeMaps ladanyi@1442: std::map< std::string,Graph::NodeMap * > nodemap_storage; ladanyi@1442: ladanyi@1442: ///Stores double type EdgeMaps ladanyi@1442: std::map< std::string,Graph::EdgeMap * > edgemap_storage; ladanyi@1442: ladanyi@1442: //Stores the default values for the different visualization node attributes ladanyi@1442: std::vector > default_nodemaps; ladanyi@1442: ladanyi@1442: //Stores the default values for the different visualization edge attributes ladanyi@1442: std::vector > default_edgemaps; ladanyi@1442: ladanyi@1442: public: ladanyi@1442: ///Constructor of MapStorage. Expects the Graph of ladanyi@1442: ///which maps will be stored in it. ladanyi@1442: ///Its all activity is initializing default values ladanyi@1442: ///for different visualization attributes ladanyi@1442: /// ladanyi@1442: ///\param graph is the graph for which the maps are stored in this object. ladanyi@1442: MapStorage(Graph &); ladanyi@1442: ladanyi@1442: ///Adds given map to storage. A name and the map itself has to be provided. ladanyi@1442: ///\param name is the name of map ladanyi@1442: ///\nodemap is the pointer of the given nodemap ladanyi@1442: ///\todo map should be given by reference! ladanyi@1442: int addNodeMap(const std::string &,Graph::NodeMap *); ladanyi@1442: ladanyi@1442: ///Adds given map to storage. A name and the map itself has to be provided. ladanyi@1442: ///\param name is the name of map ladanyi@1442: ///\edgemap is the pointer of the given edgemap ladanyi@1442: ///\todo map should be given by reference! ladanyi@1442: int addEdgeMap(const std::string &,Graph::EdgeMap *); ladanyi@1442: ladanyi@1442: ///Returns how much nodemaps is stored in \ref MapStorage ladanyi@1442: int numOfNodeMaps() {return nodemap_storage.size();}; ladanyi@1442: ladanyi@1442: ///Returns how much edgemaps is stored in \ref MapStorage ladanyi@1442: int numOfEdgeMaps() {return edgemap_storage.size();}; ladanyi@1442: ladanyi@1442: ///Returns the maximum value of the given NodeMap. NodeMap has to be given by its name. ladanyi@1442: ///\param name is the name of map of which maximum is searched ladanyi@1442: double maxOfNodeMap(const std::string &); ladanyi@1442: ladanyi@1442: ///Returns the maximum value of the given EdgeMap. EdgeMap has to be given by its name. ladanyi@1442: ///\param name is the name of map of which maximum is searched ladanyi@1442: double maxOfEdgeMap(const std::string &); ladanyi@1442: ladanyi@1442: ///Returns the minimum value of the given NodeMap. NodeMap has to be given by its name. ladanyi@1442: ///\param name is the name of map of which minimum is searched ladanyi@1442: double minOfNodeMap(const std::string &); ladanyi@1442: ladanyi@1442: ///Returns the minimum value of the given EdgeMap. EdgeMap has to be given by its name. ladanyi@1442: ///\param name is the name of map of which minimum is searched ladanyi@1442: double minOfEdgeMap(const std::string &); ladanyi@1442: ladanyi@1442: ///To be able to iterate through each maps this function returns an iterator pointing to the first nodemap in the storage. ladanyi@1442: std::map< std::string,Graph::NodeMap * >::iterator beginOfNodeMaps(){return nodemap_storage.begin();}; ladanyi@1442: ladanyi@1442: ///To be able to iterate through each maps this function returns an iterator pointing to the first edgemap in the storage. ladanyi@1442: std::map< std::string,Graph::EdgeMap * >::iterator beginOfEdgeMaps(){return edgemap_storage.begin();}; hegyi@1509: hegyi@1509: ///This function sets a default base value for the newly created node hegyi@1509: void init_maps_for_node(NodeIt); hegyi@1509: hegyi@1509: ///This function sets a default base value for the newly created node hegyi@1509: void init_maps_for_edge(Graph::Edge); ladanyi@1442: }; ladanyi@1442: ladanyi@1442: #endif //MAPSTORAGE_H