The SDON Cookbook

14/17 Page

Arranging Shapes in Complex Ways using Nesting

Like ShapeConnectors, ShapeContainers are recursive. The shapes in a ShapeContainer can themselves be ShapeContainers. This makes it possible to create almost any layout of shapes on a page.

Creating one Large Shape with a Row of Smaller Shapes Underneath

This script:

{
"Shape": {
"ShapeContainer": 
                 {
                 "Arrangement":"Column",
                 "Shapes": [
                           {"MinWidth":550,"MinHeight":700},
                           {"ShapeContainer":{"Arrangement":"Row","Shapes":[{},{},{}]}}
                           ]
                 }
        }
}

Creates this diagram with the container shapes left in place for clarity. The first ShapeContainer defines a column arrangement for two shapes. The second shape contains a ShapeContainer with three additional shapes in a row arrangement.

SDON shape rows with large shape

Using the "Hide" property on the container shapes gives us this cleaner version:

SDON shape rows with large shape with no border

Placing Multiple Trees and/or Flows on a Page

Any shape that appears in a ShapeContainer can be the root of a tree or flow defined using ShapeConnectors:

{
"Shape": {
"ShapeContainer": 
          {
          "Arrangement":"Column",
          "Shapes": [
                    {"ShapeConnector": [{"Shapes": [
                                                    {"ShapeConnector":[{"Shapes":[{},{}]}]},
                                                    {"ShapeConnector":[{"Shapes":[{},{}]}]},
                                                    {"ShapeConnector":[{"Shapes":[{},{}]}]}
                                                   ]
                                         }]
                     },
                   {"ShapeContainer":{"Arrangement":"Row","Shapes":[{},{},{}]}}
                   ]
         }
      }
}
SDON shape rows with diagram

This allows you to place multiple trees and flows on a page by using multiple shapes inside a ShapeContainer.

14/17 Page