38#ifndef DRAIN_TREE_LAYOUT_SVG
39#define DRAIN_TREE_LAYOUT_SVG
43#include <drain/Enum.h>
45#include "AlignAnchorSVG.h"
63template <AlignBase::Axis AX>
67 CoordSpan(svg::coord_t pos = 0, svg::coord_t span = 0) : pos(pos), span(span) {
78 svg::coord_t span = 0;
81 void copyFrom(
const NodeSVG & node);
83 void copyFrom(
const BBoxSVG & bbox);
87 return ! (std::isnan(pos) || std::isnan(span));
104 void detectBox(TreeSVG & group,
bool debug =
false);
110 if (node.typeIs(svg::TEXT)){
114 bbox.x += node.transform.translate.x;
115 bbox.y += node.transform.translate.y;
119 template <AlignBase::Axis AX>
135 void addStackLayout(TreeSVG &
object, AlignBase::Axis orientation = AlignBase::Axis::HORZ,
LayoutSVG::Direction direction = LayoutSVG::Direction::INCR,
unsigned short depth=0);
151 template <AlignBase::Axis AX>
176const image::TreeSVG::key_t & image::TreeSVG::getKey(
const image::AnchorElem::Anchor & type){
183const image::TreeSVG::key_t & image::TreeSVG::getKey(
const image::AnchorElem & elem){
184 return image::TreeSVG::getKey(elem.str());
Direction
Direction for "Stacked", horziontally or vertically sequentially aligned layout.
Definition LayoutSVG.h:64
const BBoxSVG & getBoundingBox() const
Get position (x,y), width and height of an object.
Definition TreeSVG.h:291
Definition DataSelector.cpp:1277
A container for a static dictionary of enumeration values.
Definition Enum.h:51
static const std::string & getKey(const std::string &s, bool lenient=true)
Convenience for object.set(...) like commands.
Definition Enum.h:144
SVG classes marking requests of relative horizontal and vertical alignment.
Definition TreeLayoutSVG.h:64
Definition TreeLayoutSVG.h:92
static void superAlign(TreeSVG &node)
Definition TreeLayoutSVG.cpp:469
static void adjustLocation(TreeSVG &group, NodeSVG &node, CoordSpan< AX > anchorSpan)
Definition TreeLayoutSVG.cpp:378
static void detectBox(TreeSVG &group, bool debug=false)
Compute the bounding box recursively in objects of type IMAGE, RECT, POLYGON and G (group).
Definition TreeLayoutSVG.cpp:46
static void setStackLayout(NodeSVG &node, AlignBase::Axis orientation, LayoutSVG::Direction direction)
Sets alignment applying stack layout in a single node.
Definition TreeLayoutSVG.cpp:231
static void addStackLayout(TreeSVG &object, AlignBase::Axis orientation=AlignBase::Axis::HORZ, LayoutSVG::Direction direction=LayoutSVG::Direction::INCR, unsigned short depth=0)
Set stack layout as a default in a subtree.
Definition TreeLayoutSVG.cpp:172