Last updated

Composite Node and Group

# Introduction

A composite node has a collection of children nodes. All children use inner coordinates of a composite node as the parent coordinates. A child node has a reference to its parent. The picture below shows its schematic class diagram.

# Architecture

CompositeNode has methods to add and delete children nodes:

  • The addChild method adds a child node.
  • The clearChildren method clears a collection of children.
  • The getChild method returns a child from the given index.
  • The getChildrenCount method returns a count of children.
  • The indexOfChild method returns a child index.
  • The removeChild method removes a child from a collection.

A Group extends CompositeNode and it has the following methods:

  • The getCache and setCache methods get and set a cache strategy. A cache is a strategy how a group and its children can be rendered into raster cache. It is a different between cache and state. A cache is a raster and state is vector cache.
  • The overridden getBounds and setBounds methods get /set bounds of the group in the parent coordinates.
  • The getContentsTransform method returns the affine transformation from inner model coordinates to the node bounds. If the node does not have its own model limits (getModelLimits() returns null) then getContentsTransform returns the identity transformation.
  • The nodes bounds can be additionally transformed in the parent’s coordinate system, i.e. scaled, translated or rotated. Instead of changing bounds directly, an additional transformation is used, which defines how the nodes bounds can be transformed into the parent. The getLocalTransform method returns this transformation. The figure below shows a process of local transformation.