Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
TreeUtilsSVG Struct Reference

Public Member Functions

template<>
void realignObject (NodeSVG &node, const CoordSpan< AlignBase::Axis::HORZ > &anchorSpan)
 
template<>
void realignObject (NodeSVG &node, const CoordSpan< AlignBase::Axis::VERT > &anchorSpan)
 
template<>
void realignObject (NodeSVG &node, const CoordSpan< AlignBase::Axis::HORZ > &span)
 
template<>
void realignObject (NodeSVG &node, const CoordSpan< AlignBase::Axis::VERT > &span)
 

Static Public Member Functions

static void detectBox (TreeSVG &group, bool debug=false)
 Compute the bounding box recursively in objects of type IMAGE, RECT, POLYGON and G (group).
 
static void getAdjustedBBox (const NodeSVG &node, BBoxSVG &bbox)
 
template<AlignBase::Axis AX>
static void adjustLocation (TreeSVG &group, NodeSVG &node, CoordSpan< AX > anchorSpan)
 
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.
 
static void setStackLayout (NodeSVG &node, AlignBase::Axis orientation, LayoutSVG::Direction direction)
 Sets alignment applying stack layout in a single node.
 
static void superAlign (TreeSVG &node)
 
template<AlignBase::Axis AX>
static void realignObject (NodeSVG &node, const CoordSpan< AX > &span)
 

Member Function Documentation

◆ addStackLayout()

void addStackLayout ( TreeSVG &  object,
AlignBase::Axis  orientation = AlignBase::Axis::HORZ,
LayoutSVG::Direction  direction = LayoutSVG::Direction::INCR,
unsigned short  depth = 0 
)
static

Set stack layout as a default in a subtree.

Set instructions, flipping axis in nesting groups of type STACK_LAYOUT.

Stack layout is applied in groups (G) of class STACK_LAYOUT. Stacking means the objects are laid subsequently next to each other, alternating horizontal and vertical orientation in each level of STACK_LAYOUTs.

Currently, the same direction parameter is used for both horizontal and vertical layout. In future, these could be set separately.

To actually align the objects, call also superAlignNew(). *

MOVE

◆ adjustLocation()

template<AlignBase::Axis AX>
void adjustLocation ( TreeSVG &  group,
NodeSVG node,
CoordSpan< AX >  anchorSpan 
)
static

Given a node (requesting Alignment), re-locate it by adjusting transform.x and .y

The anchor always resides in the same group.

◆ detectBox()

void detectBox ( TreeSVG &  group,
bool  debug = false 
)
static

Compute the bounding box recursively in objects of type IMAGE, RECT, POLYGON and G (group).

Traverses the structure recursively, updating bounding box at each level.

Future versions may also handle CIRCLE and TEXT (location)

◆ realignObject() [1/2]

template<>
void realignObject ( NodeSVG node,
const CoordSpan< AlignBase::Axis::HORZ > &  anchorSpan 
)

Pick dx = bbox.x translate.x = anchor.x -dx

◆ realignObject() [2/2]

template<>
void realignObject ( NodeSVG node,
const CoordSpan< AlignBase::Axis::VERT > &  anchorSpan 
)
Parameters
anchorSpan- width or height of the achore rectangle.

◆ setStackLayout()

void setStackLayout ( NodeSVG node,
AlignBase::Axis  orientation,
LayoutSVG::Direction  direction 
)
static

Sets alignment applying stack layout in a single node.

This function is invoked by TreeUtilsSVG::addStackLayout() .

To finally align (translate) the objects, call also TreeUtilsSVG::superAlignNew(). *

◆ superAlign()

void superAlign ( TreeSVG &  group)
static

Aligns each object which isAligned()

Ideally, each object (graphic element or compound object) should:

  • return a bounding box, or more specifically (width,height) that is, bbox.getFrame())
  • obey relocating -> RECT, IMAGE, etc. true-(x,y)-upper-left-origin: change (x,y) -> others (esp. groups: change translate(x,y)

When should an object have both?

mout.accept<LOG_NOTICE>(" adapt1: ", NodePrinter(node).str() );


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