A toolkit for working with phylogenetic data.
v0.20.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
image.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_UTILS_FORMATS_SVG_IMAGE_H_
2 #define GENESIS_UTILS_FORMATS_SVG_IMAGE_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 
36 
37 #include <iosfwd>
38 #include <string>
39 
40 namespace genesis {
41 namespace utils {
42 
43 // =================================================================================================
44 // Svg Image
45 // =================================================================================================
46 
47 struct SvgImage
48 {
49 public:
50 
51  // -------------------------------------------------------------
52  // Typedefs and Enums
53  // -------------------------------------------------------------
54 
56 
57  // -------------------------------------------------------------
58  // Constructors and Rule of Five
59  // -------------------------------------------------------------
60 
61  SvgImage(
62  std::string const& href
63  );
64 
65  SvgImage(
66  std::string const& href,
67  SvgPoint const& position
68  );
69 
70  SvgImage(
71  std::string const& href,
72  SvgPoint const& position,
73  SvgSize const& size
74  );
75 
76  SvgImage(
77  std::string const& href,
78  double x, double y,
79  double w, double h
80  );
81 
82  ~SvgImage() = default;
83 
84  SvgImage( SvgImage const& ) = default;
85  SvgImage( SvgImage&& ) = default;
86 
87  SvgImage& operator= ( SvgImage const& ) = default;
88  SvgImage& operator= ( SvgImage&& ) = default;
89 
90  // -------------------------------------------------------------
91  // Drawing Function
92  // -------------------------------------------------------------
93 
94  SvgBox bounding_box() const;
95 
96  void write(
97  std::ostream& out,
98  size_t indent = 0,
99  SvgDrawingOptions const& options = SvgDrawingOptions()
100  ) const;
101 
102  // -------------------------------------------------------------
103  // Properties
104  // -------------------------------------------------------------
105 
106  std::string id;
107 
108  std::string href;
109 
112 
114 
115 };
116 
117 } // namespace utils
118 } // namespace genesis
119 
120 #endif // include guard
SvgTransform transform
Definition: image.hpp:113
SvgBox bounding_box() const
Definition: image.cpp:87
SvgImage & operator=(SvgImage const &)=default
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:272
SvgImage(std::string const &href)
Definition: image.cpp:49
void write(std::ostream &out, size_t indent=0, SvgDrawingOptions const &options=SvgDrawingOptions()) const
Definition: image.cpp:92