Abstract base class for all SVG elements.
More...
#include <svg.hpp>
Inherits SVG::AttributeMap.
Inherited by SVG::Group, SVG::Polygon, SVG::Shape, SVG::SVG::Style, and SVG::Text.
|
class | BoundingBox |
| Represents the top left and bottom right corners of a bounding rectangle. More...
|
|
|
using | ChildList = std::vector< Element * > |
|
using | ChildMap = std::map< std::string, ChildList > |
|
|
std::vector< std::unique_ptr< Element > > | children |
|
Abstract base class for all SVG elements.
◆ add_child()
template<typename T , typename... Args>
T* SVG::Element::add_child |
( |
Args &&... |
args | ) |
|
|
inline |
Add an SVG element as a child and return a pointer to the element added
◆ autoscale() [1/2]
void SVG::Element::autoscale |
( |
const Margins & |
margins = DEFAULT_MARGINS | ) |
|
|
inline |
Automatically set the width, height, and viewBox attribute of this item so that it can contain all of its children without clipping
- Parameters
-
[in] | margins | Extra margins for the sides |
◆ autoscale() [2/2]
void SVG::Element::autoscale |
( |
const double |
margin | ) |
|
|
inline |
Like other autoscale() but accepts margin as a percentage
◆ find_numeric()
double SVG::Element::find_numeric |
( |
const std::string & |
key | ) |
|
|
inlineprotected |
The SVG tag of this element
Return the numeric attribute (if it exists) or NAN
- Parameters
-
[in] | key | Name of the attribute |
◆ get_bbox() [1/2]
Compute the bounding box necessary to contain this element
◆ get_bbox() [2/2]
Recursively compute a bounding box
◆ get_children() [1/2]
template<typename T >
std::vector<T*> SVG::Element::get_children |
( |
| ) |
|
|
inline |
Return all children of type T
◆ get_children() [2/2]
Element::ChildMap SVG::Element::get_children |
( |
| ) |
|
|
inline |
Recursively compute all of the children of an SVG element
◆ get_children_helper()
std::vector< Element * > SVG::Element::get_children_helper |
( |
| ) |
|
|
inlineprotected |
Smart pointers to child elements
Helper function which populates a std::deque with all of an Element's children
◆ get_element_by_id()
Element * SVG::Element::get_element_by_id |
( |
const std::string & |
id | ) |
|
|
inline |
Return the SVG element that has a certain id
◆ get_elements_by_class()
std::vector< Element * > SVG::Element::get_elements_by_class |
( |
const std::string & |
clsname | ) |
|
|
inline |
Return all SVG elements with a certain class name
◆ get_immediate_children() [1/2]
template<typename T >
std::vector<T*> SVG::Element::get_immediate_children |
( |
| ) |
|
|
inline |
Return all immediate children of type T
◆ get_immediate_children() [2/2]
template<>
Element::ChildList SVG::Element::get_immediate_children |
( |
| ) |
|
|
inline |
Return all immediate children, regardless of type, as Element pointers
◆ operator<<()
template<typename T >
Element& SVG::Element::operator<< |
( |
T && |
node | ) |
|
|
inline |
Move an SVG element into this container
◆ svg_to_string()
std::string SVG::Element::svg_to_string |
( |
const size_t |
indent_level | ) |
|
|
inlineprotectedvirtual |
Return the string representation of an SVG element
- Parameters
-
[out] | indent_level | The current level of indentation |
Reimplemented in SVG::SVG::Style.
◆ tag()
virtual std::string SVG::Element::tag |
( |
| ) |
|
|
protectedpure virtual |
The documentation for this class was generated from the following file: