Static Public Member Functions | List of all members
TreeUtilsSVG Struct Reference

SVG classes marking requests of relative horizontal and vertical alignment. More...

#include <TreeUtilsSVG.h>

Static Public Member Functions

static bool computeBoundingBox (const TreeSVG &group, drain::Box< svg::coord_t > &box)
 Compute bounding box of the whole structure.
 
static void finalizeBoundingBox (TreeSVG &svg)
 Compute bounding box and set the top-level SVG width, height and viewBox properties.
 
static void setRelativePaths (drain::image::TreeSVG &object, const drain::FilePath &filepath)
 Computes the width and height for a bounding box IMAGE and RECT elements. More...
 
static void superAlign (TreeSVG &node, AlignBase::Axis orientation=AlignBase::Axis::HORZ, LayoutSVG::Direction direction=LayoutSVG::Direction::INCR)
 
static void realignObject (const Box< svg::coord_t > &anchorBoxHorz, const Box< svg::coord_t > &anchorBoxVert, TreeSVG &obj)
 Align object respect to an anchor frame.
 
static void realignObjectHorz (TreeSVG &obj, const Box< svg::coord_t > &anchorBoxHorz)
 
static void realignObjectVert (TreeSVG &obj, const Box< svg::coord_t > &anchorBoxVert)
 
static void translateAll (TreeSVG &group, const Point2D< svg::coord_t > &offset)
 Recursively move elements with (x, y). More...
 

Detailed Description

SVG classes marking requests of relative horizontal and vertical alignment.

Member Function Documentation

◆ realignObjectVert()

void realignObjectVert ( TreeSVG &  object,
const Box< svg::coord_t > &  anchorBoxVert 
)
static
Parameters
anchorSpan- width or height of the achore rectangle.

◆ setRelativePaths()

static void setRelativePaths ( drain::image::TreeSVG &  object,
const drain::FilePath filepath 
)
static

Computes the width and height for a bounding box IMAGE and RECT elements.

The result is the minimal bounding box that covers the IMAGE and RECT elements aligned non-overlapping in a row (orientation HORZ ) or a column (orientation VERT ).

Future versions may also handle CIRCLE and TEXT (location)

◆ superAlign()

void superAlign ( TreeSVG &  object,
AlignBase::Axis  orientation = AlignBase::Axis::HORZ,
LayoutSVG::Direction  direction = LayoutSVG::Direction::INCR 
)
static
Parameters
anchorSpan- width or height of the achore rectangle. Traverse the whole thing, at least an ALIGN_GROUP...

Recursion: before aligning an element, align its contents. Anchors.

In SVG, elements that directly define a graphical object – like RECT, CIRCLE or POLYLINE are here called graphical elements . Examples of other, abstract elements are G (group), METADATA or DESC elements.

Alignment of graphical element can controlled by methods of drain::image::AlignSVG inherited by drain::image::NodeSVG . Elements can be aligned sequentially - stacked in rows or colums - as well as superposing them over other elements.

Elements respect to which another element is aligned is called an anchor. Anchors can be implicit or explicitly set.

  • By default, any graphical element serves as an anchor for the next element (in order of definition in an SVG document).
  • However, if a graphical element is assigned style class drain::image::LayoutSVG::FLOAT , the previous anchor will stay intact.
  • Any group G can explicitly define one of its children (direct descendants) to be the default anchor for all the elements in the group.
  • Any graphical element can override the previous rules by setting any of its siblings (children of the same group) to be its private anchor.
Parameters
offset- start?
See also
NodeSVG

If main orientation (inside containers) is HORZ, stack containers VERT. And vice versa.

mout.special<LOG_WARNING>("Resulting BBOX=", objectBBox, " me: \t", object.data);

mout.accept<LOG_NOTICE>("Expanding ... ", bbox, " now, after: ", entry.second.data);

◆ translateAll()

void translateAll ( TreeSVG &  object,
const Point2D< svg::coord_t > &  offset 
)
static

Recursively move elements with (x, y).

Iteratively traverses elements of ALIGN_GROUP, and (re)aligns elements inside them as panels.


The documentation for this struct was generated from the following files: