A toolkit for working with phylogenetic data.
v0.18.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
group.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_UTILS_FORMATS_SVG_GROUP_H_
2 #define GENESIS_UTILS_FORMATS_SVG_GROUP_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2017 Lucas Czech
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 
21  Contact:
22  Lucas Czech <lucas.czech@h-its.org>
23  Exelixis Lab, Heidelberg Institute for Theoretical Studies
24  Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
25 */
26 
38 
39 #include <iosfwd>
40 
41 namespace genesis {
42 namespace utils {
43 
44 // =================================================================================================
45 // Svg Group
46 // =================================================================================================
47 
48 struct SvgGroup
49 {
50 public:
51 
52  // -------------------------------------------------------------
53  // Typedefs and Enums
54  // -------------------------------------------------------------
55 
57 
58  // -------------------------------------------------------------
59  // Constructors and Rule of Five
60  // -------------------------------------------------------------
61 
62  SvgGroup() = default;
63  ~SvgGroup() = default;
64 
65  SvgGroup( SvgGroup const& ) = default;
66  SvgGroup( SvgGroup&& ) = default;
67 
68  SvgGroup& operator= ( SvgGroup const& ) = default;
69  SvgGroup& operator= ( SvgGroup&& ) = default;
70 
71  // -------------------------------------------------------------
72  // Drawing Function
73  // -------------------------------------------------------------
74 
75  SvgBox bounding_box() const;
76 
77  void write(
78  std::ostream& out,
79  size_t indent = 0,
80  SvgDrawingOptions const& options = SvgDrawingOptions()
81  ) const;
82 
88  self_type& add( SvgObject const& object );
89  self_type& add( SvgObject&& object );
90 
91 
95  self_type& operator << ( SvgObject const& object );
96  self_type& operator << ( SvgObject&& object );
97 
98  bool empty() const
99  {
100  return content_.empty();
101  }
102 
103  // -------------------------------------------------------------
104  // Properties
105  // -------------------------------------------------------------
106 
107  std::string id;
108  std::vector< SvgObject > content_;
110 
111 };
112 
113 } // namespace utils
114 } // namespace genesis
115 
116 #endif // include guard
std::vector< SvgObject > content_
Definition: group.hpp:108
void write(std::ostream &out, size_t indent=0, SvgDrawingOptions const &options=SvgDrawingOptions()) const
Definition: group.cpp:59
SvgBox bounding_box() const
Definition: group.cpp:49
Provides some valuable additions to STD.
SvgGroup & operator=(SvgGroup const &)=default
self_type & add(SvgObject const &object)
Add an SvgObject to the document.
Definition: group.cpp:80
std::string indent(std::string const &text, std::string const &indentation)
Indent each line of text with indentation and return the result.
Definition: string.cpp:158
SvgTransform transform
Definition: group.hpp:109
bool empty() const
Definition: group.hpp:98
self_type & operator<<(SvgObject const &object)
Shortcut operator for add(), which allows an even more fluent interface.
Definition: group.cpp:92