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>
137 AlignBase::Axis orientation = AlignBase::Axis::HORZ,
138 LayoutSVG::DirectionHorz directionHorz = LayoutSVG::DirectionHorz::RIGHT,
139 LayoutSVG::DirectionVert directionVert = LayoutSVG::DirectionVert::DOWN,
140 unsigned short depth=0);
149 void setStackLayout(
NodeSVG & node, AlignBase::Axis orientation, LayoutSVG::DirectionHorz dirHorz, LayoutSVG::DirectionVert dirVert);
157 template <AlignBase::Axis AX>
182const image::TreeSVG::key_t & image::TreeSVG::getKey(
const image::AnchorElem::Anchor & type){
189const image::TreeSVG::key_t & image::TreeSVG::getKey(
const image::AnchorElem & elem){
190 return image::TreeSVG::getKey(elem.str());
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:494
static void addStackLayout(TreeSVG &object, AlignBase::Axis orientation=AlignBase::Axis::HORZ, LayoutSVG::DirectionHorz directionHorz=LayoutSVG::DirectionHorz::RIGHT, LayoutSVG::DirectionVert directionVert=LayoutSVG::DirectionVert::DOWN, unsigned short depth=0)
Set stack layout as a default in a subtree.
Definition TreeLayoutSVG.cpp:174
static void setStackLayout(NodeSVG &node, AlignBase::Axis orientation, LayoutSVG::DirectionHorz dirHorz, LayoutSVG::DirectionVert dirVert)
Sets alignment applying stack layout in a single node.
Definition TreeLayoutSVG.cpp:236
static void adjustLocation(TreeSVG &group, NodeSVG &node, CoordSpan< AX > anchorSpan)
Definition TreeLayoutSVG.cpp:403
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