Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rcsoft_map_graph.h
1 
2 /***************************************************************************
3  * map_graph.h - Map graph for storing pathplan information
4  *
5  * Created: Tue Jun 30 09:25:09 2009 (RoboCup 2009, Graz)
6  * Copyright 2009 Tim Niemueller [www.niemueller.de]
7  *
8  * $Id: rcsoft_map_graph.h 2710 2009-06-30 12:47:20Z tim $
9  *
10  ****************************************************************************/
11 
12 /* This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version. A runtime exception applies to
16  * this software (see LICENSE.GPL_WRE file mentioned below for details).
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Library General Public License for more details.
22  *
23  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
24  */
25 
26 #ifndef __UTILS_GRAPH_RCSOFT_MAP_GRAPH_H_
27 #define __UTILS_GRAPH_RCSOFT_MAP_GRAPH_H_
28 
29 #include "rcsoft_map_node.h"
30 
31 namespace xmlpp {
32  class DomParser;
33  class Node;
34 }
35 
36 namespace fawkes {
37 #if 0 /* just to make Emacs auto-indent happy */
38 }
39 #endif
40 
42 {
43  public:
44  RCSoftMapGraph(std::string filename);
45  ~RCSoftMapGraph();
46 
47  std::string graph_name();
48  std::vector<fawkes::RCSoftMapNode> nodes();
49  fawkes::RCSoftMapNode node(std::string name_or_alias);
50  fawkes::RCSoftMapNode root_node();
51 
52  fawkes::RCSoftMapNode closest_node(float pos_x, float pos_y,
53  std::string property);
54 
55  std::vector<fawkes::RCSoftMapNode> search_nodes(std::string property);
56 
57  private:
58  void parse_graph();
59  std::string get_node_text(xmlpp::Node *root, std::string subnode = "");
60  float get_node_float(xmlpp::Node *root, std::string subnode = "");
61  RCSoftMapNode get_node(xmlpp::Node *node);
62 
63  private:
64  xmlpp::DomParser *__dom;
65  xmlpp::Node *__root;
66 
67  fawkes::RCSoftMapNode __root_node;
68  std::string __graph_name;
69  std::vector<fawkes::RCSoftMapNode> __nodes;
70 };
71 
72 } // end of namespace fawkes
73 
74 #endif