A toolkit for working with phylogenetic data.
v0.20.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
svg/document.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_UTILS_FORMATS_SVG_DOCUMENT_H_
2 #define GENESIS_UTILS_FORMATS_SVG_DOCUMENT_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 
37 
38 #include <iosfwd>
39 #include <vector>
40 
41 namespace genesis {
42 namespace utils {
43 
44 // =================================================================================================
45 // Svg Document
46 // =================================================================================================
47 
49 {
50 public:
51 
52  // -------------------------------------------------------------
53  // Typedefs and Enums
54  // -------------------------------------------------------------
55 
57 
58  static std::string indentation_string;
59 
60  enum class Overflow
61  {
62  kNone,
63  kVisible,
64  kHidden,
65  kScroll,
66  kAuto,
67  kInherit
68  };
69 
70  // -------------------------------------------------------------
71  // Constructors and Rule of Five
72  // -------------------------------------------------------------
73 
74  SvgDocument() = default;
75  ~SvgDocument() = default;
76 
77  SvgDocument( SvgDocument const& ) = default;
78  SvgDocument( SvgDocument&& ) = default;
79 
80  SvgDocument& operator= ( SvgDocument const& ) = default;
81  SvgDocument& operator= ( SvgDocument&& ) = default;
82 
83  // -------------------------------------------------------------
84  // Members
85  // -------------------------------------------------------------
86 
87  SvgBox bounding_box() const;
88 
89  void write( std::ostream& out ) const;
90 
96  self_type& add( SvgObject const& object );
97  self_type& add( SvgObject&& object );
98 
102  self_type& operator << ( SvgObject const& object );
103  self_type& operator << ( SvgObject&& object );
104 
105  // -------------------------------------------------------------
106  // Helper Functions
107  // -------------------------------------------------------------
108 
109 private:
110 
111  static std::string overflow_to_string( Overflow value );
112 
113  // -------------------------------------------------------------
114  // Data Members
115  // -------------------------------------------------------------
116 
117 public:
118 
121 
122  std::vector< SvgDefinitions > defs;
123 
124 private:
125 
126  std::vector< SvgObject > content_;
127 
128 };
129 
130 } // namespace utils
131 } // namespace genesis
132 
133 #endif // include guard
std::vector< SvgDefinitions > defs
SvgDocument & operator=(SvgDocument const &)=default
self_type & add(SvgObject const &object)
Add an SvgObject to the document.
void write(std::ostream &out) const
Write the SvgDocument to an output stream.
SvgBox bounding_box() const
self_type & operator<<(SvgObject const &object)
Shortcut operator for add(), which allows an even more fluent interface.
static std::string indentation_string