Controlling other dizmos

Using the viewer and bundle object you can install and start a dizmo. You can check which dizmos are installed and running and you can get additional information about a dizmo. You can even include additional dizmos together with your dizmo and instantiate them when needed.

// install a dizmo that is located inside of my own bundle in the dizmos directory
viewer.installBundle("bundle://assets/dizmos/mySubDizmo.dzm",startDizmo);

// instantiate the dizmo at the location x = 150 , y = 100
function startDizmo(bundleid,error) {
    var newBundle = new dizmojs.Bundle(bundleid);
    var newDizmo = newBundle.instantiateDizmo({
        'geometry/x' : 150 ,
        'geometry/y' : 100
    });
}

// get all the running dizmo instances
var runningDizmos = viewer.getDizmos();

// get the Ids of all running dizmos
var to_dizmo_id = function to_bundle_id (dzm) {
        return dzm.identifier;
};
var runningDizmoIds = runningDizmos.map(to_dizmo_id);

You can also close a dizmo. Note however, that you can only close your own dizmo.

// close the dizmo
myDizmo.close();

If you wish to uninstall a bundle you first have to get an bundle instance

var yourBundle=new dizmojs.Bundle('com.dizmo.mySubDizmo');

Then, call the uninstall function on that bundle instance

yourBundle.uninstall();

For a complete list of the available viewer and bundle attributes and functions, please refer to the API documentation of the dizmojs.Viewer and dizmojs.Bundleclass.

When a new dizmo is instantiated with instantiateDizmo(options, publicProperties, privateProperties);, you can set with the options parameter where it should appear in dizmoSpace. Please check Dizmo coordinate system for more details.

Once a dizmo is instantiated in dizmoSpace, you can move, set the position, size, zoom level and angle of other dizmos by changing their public properties with the following functions:

setAttribute("geometry/angle");
setAttribute("geometry/height");
setAttribute("geometry/maxheight");
setAttribute("geometry/minheight");
setAttribute("geometry/width");
setAttribute("geometry/maxwidth");
setAttribute("geometry/minwidth");
setAttribute("geometry/x");
setAttribute("geometry/y");
setAttribute("geometry/zoom");

For a more detailed description of these functions, take a look in the API documentation of the dizmojs.Dizmo class.