hpp-manipulation  4.9.0
Classes for manipulation planning.
dot.hh
Go to the documentation of this file.
1 // Copyright (c) 2014, LAAS-CNRS
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4 // This file is part of hpp-manipulation.
5 // hpp-manipulation is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // hpp-manipulation is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // hpp-manipulation. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HPP_MANIPULATION_GRAPH_DOT_HH
18 # define HPP_MANIPULATION_GRAPH_DOT_HH
19 
20 # include <ostream>
21 # include <sstream>
22 # include <map>
23 # include <list>
24 
25 namespace hpp {
26  namespace manipulation {
27  namespace graph {
28  namespace dot {
29 
31  typedef std::pair <std::string, std::string> Pair;
32  typedef std::map <std::string, std::string> Map;
33 
35  Map attr;
36 
37  inline void insertWithQuote (const std::string& K, const std::string& V) {
38  attr.insert (Pair (K, "\"" + V + "\""));
39  }
40  inline void insert (const std::string& K, const std::string& V) {
41  attr.insert (Pair (K, V));
42  }
43  std::string& operator [] (const std::string& K) {
44  return attr [K];
45  }
47  separator (", "), openSection ("["), closeSection ("]"),
48  attr () {};
49  };
50 
51  struct Tooltip {
52  static const std::string tooltipendl;
53  typedef std::list <std::string> TooltipLineVector;
54  TooltipLineVector v;
55 
56  Tooltip () : v() {};
57  inline std::string toStr () const {
58  std::stringstream ss;
59  size_t i = v.size ();
60  for (TooltipLineVector::const_iterator
61  it = v.begin (); it != v.end (); ++it ) {
62  ss << *it;
63  i--;
64  if (i > 0) ss << tooltipendl;
65  }
66  return ss.str ();
67  }
68  inline void addLine (const std::string& l) {
69  v.push_back (l);
70  }
71  };
72 
73  std::ostream& insertComments (std::ostream& os, const std::string& c);
74 
75  std::ostream& operator<< (std::ostream& os, const DrawingAttributes& da);
76  } // namespace dot
77  } // namespace graph
78  } // namespace manipulation
79 } // namespace hpp
80 
81 #endif // HPP_MANIPULATION_GRAPH_DOT_HH
std::string closeSection
Definition: dot.hh:34
std::ostream & insertComments(std::ostream &os, const std::string &c)
std::string & operator[](const std::string &K)
Definition: dot.hh:43
Vec3f c
std::map< std::string, std::string > Map
Definition: dot.hh:32
void addLine(const std::string &l)
Definition: dot.hh:68
void insert(const std::string &K, const std::string &V)
Definition: dot.hh:40
std::pair< std::string, std::string > Pair
Definition: dot.hh:31
std::string openSection
Definition: dot.hh:34
static const std::string tooltipendl
Definition: dot.hh:52
std::string separator
Definition: dot.hh:34
std::string toStr() const
Definition: dot.hh:57
void insertWithQuote(const std::string &K, const std::string &V)
Definition: dot.hh:37
TooltipLineVector v
Definition: dot.hh:54
std::list< std::string > TooltipLineVector
Definition: dot.hh:53
std::ostream & operator<<(std::ostream &os, const DrawingAttributes &da)