The ring array plug-in has several key classes:
This section examines each of these classes in terms of their function within the system.
The RingMaster class (derived from ReferenceTarget) is responsible for directing the entire system after it is created. It maintains a table of all the nodes it controls. It also manages the user interface parameters of the system using a parameter block. For more details on parameter blocks see the topic on Parameter Blocks. This class has a very important method named GetValue(). The slave controllers directing the position of the ring nodes call this method in their implementation of Control::GetValue(). This allows the RingMaster to control all the slaves based on their position in the ring array and the UI parameters.
The class SlaveControl is derived from class Control. In its implementation of GetValue() the slave controller calls the method of the same name on the RingMaster. This is how the slaves derive their position and orientation from the master -- the master simply supplies all the values to each of its slaves. Each slave controller has a reference to the RingMaster. This is used to register a dependency between the slave controller and the RingMaster in the system. If the user changes the parameters of the master controller, it sends a REFMSG_CHANGE message up to the slaves, which sends it to the nodes they control. This invalidates the nodes and causes them to get redrawn in the next screen update.
The class RingMasterCreationManager (derived from both MouseCallBack and ReferenceMaker) manages the user interaction during the creation process. It is used to handle the creation of the center dummy object and the box objects in the ring surrounding the center. In addition to creating the objects, it creates nodes in the scene for these objects, sets their transform controllers, and links the ring nodes to the parent node at the center of the ring. The creation manager maintains a data member theMaster. This is a pointer to an instance of class RingMaster. This is used to call methods of the master such as its BeginEditParams() and EndEditParams(). This object also maintains a reference to the first slave node it creates. This is used so that if the user deselects this slave node the creation process will begin with a new item (and not continue to edit the existing item if the UI controls are adjusted). An instance of this class is the mouse callback object for the RingMasterCreateMode class described below.
The class RingMasterCreateMode (derived from CommandMode) is the command mode that is put into effect when the Ring Array is being created. A command mode has a mouse procedure that handles the user/mouse interaction during creation. This takes place during execution of the ClassDesc::BeginCreate() method. See the section below for more details on how BeginCreate() and EndCreate() bracket the creation phase of a plug-in. The mouse callback object portion of the command mode (returned from method CommandMode::MouseProc()) is an instance of class RingMasterCreationManager.