Hierarchies

Packing or grouping things together into one place is something we do quite naturally, we use (paper-) folders, boxes, cases, binders and the like.

Dizmo allows the user to have hierarchies in a similar way. Every object (dizmo) may be the carrier of other objects that should be put into one (geometrically identifiable) place. If the user zooms out the items will automatically loose their detail at a certain zoom level and then disappear completely when zooming further out.

However aforementioned carrier (which is the Pad dizmo) will most probably still be visible. This creates a hierarchy that remains geometrically stable and therefore comprehensible for the user. The user might remember that they have put something "in the upper left-hand corner Pad" and they can zoom to that spot instantly by just double clicking on the Pad and retrieve the items.

Besides organizing objects in hierarchies, having objects carry other objects allows users to drag a group of items to a different spot in dizmoSpace without losing their relative spatial order. This is particularly important if the spatial arrangement has a meaning to the user such as a floor plan in which control and visualization elements have been arranged to reflect their real-world position or impact.

Please refer to Dizmo coordinate system.

As dizmos can be arranged in a hierarchical order, the dizmo object can have a parent or "spawn" a child. The parent and child dizmo objects themselves are instances of the dizmojs.Dizmo class. If a dizmo is a child of another dizmo, coordinates and angles are relative to the parent dizmo.

Since the dizmos can be arranged hierarchically in dizmoSpace, there are operations to get the parent or the children of the dizmo object.

Get the parent object of your own dizmo:

var parent=dizmo.getParentDizmo();

Get an array containing all the children objects of your dizmo:

var children=dizmo.getChildDizmos();

You can then for example loop through the array and modify the attributes of those child dizmos or access their public data:

for (var i = children.length - 1; i >= 0; i--) {
        children[i].setAttribute("geometry/angle", 0);
        var data=children[i].publicStorage.getProperty("stdout");
}

The subtree "/dizmos/[dizmoID]/publicStorage" of these child dizmos can be read and written to. Please refer to chapter Communication.

Setting a new parent

You can also set a dizmo to have a new parent, use the following call and pass a dizmo instance:

var parentChanged = dizmo.setParentDizmo(myNewDizmo);

parentChanged will be true if changing the parent worked, otherwise it will return false.

var currentParent=dizmo.getParentDizmo();

This call will return a dizmo instance of the current parent or in the case of dizmoSpace, undefined.

For example, if you want to have no parent set on your dizmo, use

dizmo.setParentDizmo(null)

Limitations

Setting a new parent for a dizmo is not possible if