38#ifndef DRAIN_TREE_UTILS_SVG
39#define DRAIN_TREE_UTILS_SVG
43#include <drain/image/AlignAnchorSVG.h>
44#include <drain/util/Frame.h>
45#include <drain/util/EnumFlags.h>
46#include <drain/util/Rectangle.h>
57 bool absolutePaths = true;
59 // Currently, applications are recommended to handle "false" and "none". Or "auto"?
61 // FontSizes fontSize;
63 inline // maxPerGroup(10), layout(Alignment::HORZ, LayoutSVG::INCR), legend(LEFT, EMBED),
64 PanelConfSVG() : absolutePaths(true){
79template <AlignBase::Axis AX>
83 CoordSpan(svg::coord_t pos = 0, svg::coord_t span = 0) : pos(pos), span(span) {
94 svg::coord_t span = 0;
97 void copyFrom(
const NodeSVG & node);
99 void copyFrom(
const BBoxSVG & bbox);
110 return ! (std::isnan(pos) || std::isnan(span));
128 void detectBox(TreeSVG & group,
bool debug =
false);
134 bbox.x += node.transform.translate.x;
135 bbox.y += node.transform.translate.y;
138 template <AlignBase::Axis AX>
154 void addStackLayout(TreeSVG &
object, AlignBase::Axis orientation = AlignBase::Axis::HORZ,
LayoutSVG::Direction direction = LayoutSVG::Direction::INCR,
unsigned short depth=0);
170 template <AlignBase::Axis AX>
192 const std::string dir;
195 const std::string prefix;
199 dir(filepath.dir.empty() ?
"" : filepath.dir.str()+
'/'),
203 int visitPrefix(TreeSVG & tree,
const TreeSVG::path_t & path)
override;
217 const std::string LOCAL;
220 const std::string SHARED;
230 int visitPrefix(TreeSVG & tree,
const TreeSVG::path_t & path)
override {
235 int visitPostfix(TreeSVG & tree,
const TreeSVG::path_t & path)
override;
242 typedef std::map<std::string, unsigned short> variableStat_t;
Extracts and stores directory path, base filename and extension.
Definition FilePath.h:58
Default implementation of a tree visitor (concept) compatible TreeUtils::traverser()
Definition TreeUtils.h:270
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:232
Definition TreeUtilsSVG.h:187
Definition DataSelector.cpp:1277
SVG classes marking requests of relative horizontal and vertical alignment.
Definition TreeUtilsSVG.h:80
Definition TreeUtilsSVG.h:115
static void superAlign(TreeSVG &node)
Definition TreeUtilsSVG.cpp:470
static void adjustLocation(TreeSVG &group, NodeSVG &node, CoordSpan< AX > anchorSpan)
Definition TreeUtilsSVG.cpp:389
static void detectBox(TreeSVG &group, bool debug=false)
Compute the bounding box recursively in objects of type IMAGE, RECT, POLYGON and G (group).
Definition TreeUtilsSVG.cpp:63
static void setStackLayout(NodeSVG &node, AlignBase::Axis orientation, LayoutSVG::Direction direction)
Sets alignment applying stack layout in a single node.
Definition TreeUtilsSVG.cpp:246
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 TreeUtilsSVG.cpp:191