A library for working with phylogenetic and population genetic data.
v0.32.0
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-2023 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 <lczech@carnegiescience.edu>
23
Department of Plant Biology, Carnegie Institution For Science
24
260 Panama Street, Stanford, CA 94305, USA
25
*/
26
34
#include "
genesis/utils/color/color.hpp
"
35
#include "
genesis/utils/formats/svg/definitions.hpp
"
36
#include "
genesis/utils/formats/svg/gradient.hpp
"
37
#include "
genesis/utils/formats/svg/object.hpp
"
38
#include "
genesis/utils/io/output_target.hpp
"
39
40
#include <iosfwd>
41
#include <vector>
42
43
namespace
genesis
{
44
namespace
utils {
45
46
// =================================================================================================
47
// Svg Document
48
// =================================================================================================
49
50
class
SvgDocument
51
{
52
public
:
53
54
// -------------------------------------------------------------
55
// Typedefs and Enums
56
// -------------------------------------------------------------
57
58
using
self_type
=
SvgDocument
;
59
60
static
std::string
indentation_string
;
61
62
enum class
Overflow
63
{
64
kNone
,
65
kVisible
,
66
kHidden
,
67
kScroll
,
68
kAuto
,
69
kInherit
70
};
71
72
// -------------------------------------------------------------
73
// Constructors and Rule of Five
74
// -------------------------------------------------------------
75
76
SvgDocument
() =
default
;
77
~SvgDocument
() =
default
;
78
79
SvgDocument
(
SvgDocument
const
& ) =
default
;
80
SvgDocument
(
SvgDocument
&& ) =
default
;
81
82
SvgDocument
&
operator=
(
SvgDocument
const
& ) =
default
;
83
SvgDocument
&
operator=
(
SvgDocument
&& ) =
default
;
84
85
// -------------------------------------------------------------
86
// Members
87
// -------------------------------------------------------------
88
89
SvgBox
bounding_box
()
const
;
90
91
void
write
( std::ostream& out )
const
;
92
void
write
( std::shared_ptr<utils::BaseOutputTarget> target )
const
;
93
99
self_type
&
add
(
SvgObject
const
&
object
);
100
self_type
&
add
(
SvgObject
&&
object
);
101
105
self_type
&
operator <<
(
SvgObject
const
&
object
);
106
self_type
&
operator <<
(
SvgObject
&&
object
);
107
108
// -------------------------------------------------------------
109
// Helper Functions
110
// -------------------------------------------------------------
111
112
private
:
113
114
static
std::string overflow_to_string(
Overflow
value );
115
116
// -------------------------------------------------------------
117
// Data Members
118
// -------------------------------------------------------------
119
120
public
:
121
122
SvgMargin
margin
;
123
Overflow
overflow
=
Overflow::kNone
;
124
125
std::vector< SvgDefinitions >
defs
;
126
Color
background_color
=
Color
( 1.0, 1.0, 1.0, 1.0 );
127
128
private
:
129
130
std::vector< SvgObject > content_;
131
132
};
133
134
}
// namespace utils
135
}
// namespace genesis
136
137
#endif // include guard
genesis::utils::SvgDocument::~SvgDocument
~SvgDocument()=default
genesis::utils::Color
Definition:
color.hpp:47
genesis::utils::SvgDocument::Overflow::kInherit
@ kInherit
genesis::utils::SvgDocument::margin
SvgMargin margin
Definition:
svg/document.hpp:122
genesis::utils::SvgBox
Definition:
utils/formats/svg/helper.hpp:127
genesis::utils::SvgMargin
Definition:
utils/formats/svg/helper.hpp:92
genesis::utils::SvgDocument::write
void write(std::ostream &out) const
Write the SvgDocument to an output stream.
Definition:
svg/document.cpp:70
genesis::utils::SvgDocument::overflow
Overflow overflow
Definition:
svg/document.hpp:123
genesis::utils::SvgDocument::indentation_string
static std::string indentation_string
Definition:
svg/document.hpp:60
genesis::utils::SvgDocument::operator<<
self_type & operator<<(SvgObject const &object)
Shortcut operator for add(), which allows an even more fluent interface.
Definition:
svg/document.cpp:169
genesis::utils::SvgDocument::add
self_type & add(SvgObject const &object)
Add an SvgObject to the document.
Definition:
svg/document.cpp:157
genesis::utils::SvgDocument::SvgDocument
SvgDocument()=default
gradient.hpp
genesis::utils::SvgDocument::background_color
Color background_color
Definition:
svg/document.hpp:126
genesis
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Definition:
placement/formats/edge_color.cpp:42
genesis::utils::SvgDocument::Overflow::kAuto
@ kAuto
definitions.hpp
color.hpp
Header of Color class.
genesis::utils::SvgDocument
Definition:
svg/document.hpp:50
genesis::utils::SvgDocument::defs
std::vector< SvgDefinitions > defs
Definition:
svg/document.hpp:125
genesis::utils::SvgDocument::Overflow::kNone
@ kNone
genesis::utils::SvgDocument::self_type
SvgDocument self_type
Definition:
svg/document.hpp:58
genesis::utils::SvgDocument::bounding_box
SvgBox bounding_box() const
Definition:
svg/document.cpp:57
output_target.hpp
genesis::utils::SvgDocument::Overflow::kVisible
@ kVisible
genesis::utils::SvgDocument::operator=
SvgDocument & operator=(SvgDocument const &)=default
genesis::utils::SvgObject
Definition:
object.hpp:46
object.hpp
genesis::utils::SvgDocument::Overflow::kScroll
@ kScroll
genesis::utils::SvgDocument::Overflow
Overflow
Definition:
svg/document.hpp:62
genesis::utils::SvgDocument::Overflow::kHidden
@ kHidden
lib
genesis
utils
formats
svg
document.hpp
Generated on Mon Aug 5 2024 16:57:51 for genesis by
1.8.17