Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * map_graph.h - Map graph for storing pathplan information 00004 * 00005 * Created: Tue Jun 30 09:25:09 2009 (RoboCup 2009, Graz) 00006 * Copyright 2009 Tim Niemueller [www.niemueller.de] 00007 * 00008 * $Id: rcsoft_map_graph.h 2710 2009-06-30 12:47:20Z tim $ 00009 * 00010 ****************************************************************************/ 00011 00012 /* This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation; either version 2 of the License, or 00015 * (at your option) any later version. A runtime exception applies to 00016 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00017 * 00018 * This program is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU Library General Public License for more details. 00022 * 00023 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00024 */ 00025 00026 #ifndef __UTILS_GRAPH_RCSOFT_MAP_GRAPH_H_ 00027 #define __UTILS_GRAPH_RCSOFT_MAP_GRAPH_H_ 00028 00029 #include "rcsoft_map_node.h" 00030 00031 namespace xmlpp { 00032 class DomParser; 00033 class Node; 00034 } 00035 00036 namespace fawkes { 00037 #if 0 /* just to make Emacs auto-indent happy */ 00038 } 00039 #endif 00040 00041 class RCSoftMapGraph 00042 { 00043 public: 00044 RCSoftMapGraph(std::string filename); 00045 ~RCSoftMapGraph(); 00046 00047 std::string graph_name(); 00048 std::vector<fawkes::RCSoftMapNode> nodes(); 00049 fawkes::RCSoftMapNode node(std::string name_or_alias); 00050 fawkes::RCSoftMapNode root_node(); 00051 00052 fawkes::RCSoftMapNode closest_node(float pos_x, float pos_y, 00053 std::string property); 00054 00055 std::vector<fawkes::RCSoftMapNode> search_nodes(std::string property); 00056 00057 private: 00058 void parse_graph(); 00059 std::string get_node_text(xmlpp::Node *root, std::string subnode = ""); 00060 float get_node_float(xmlpp::Node *root, std::string subnode = ""); 00061 RCSoftMapNode get_node(xmlpp::Node *node); 00062 00063 private: 00064 xmlpp::DomParser *__dom; 00065 xmlpp::Node *__root; 00066 00067 fawkes::RCSoftMapNode __root_node; 00068 std::string __graph_name; 00069 std::vector<fawkes::RCSoftMapNode> __nodes; 00070 }; 00071 00072 } // end of namespace fawkes 00073 00074 #endif