MhSnapper
Introduction
MhSnapper is the primary Snapper
within the abstract. This class follows the composition over inheritance pattern and as such should not be overridden. Instead, the behavior of the Snapper
is determined by the MhSnapperShape
and MhBehavior
s that compose it.
Composition of an MhSnapper
MhSnapper
contains the minimum amount of state required for it to exist in the drawing. This includes things like position, rotation, and family relationships with other Snapper
s. State and functionality are provided by the MhSnapper
's MhBehavior
s and MhSnapperShape
.
MhSnapperShape
THe MhSnapperShape
on MhSnapper
contains the majority of the MhSnapper
's state, such as category, dimensions, Connector
s, and other required fields. The MhSnapperShape
is responsible for determining the identity of the MhSnapper
and is provided to the MhSnapper
by the MhSnapperSpawner
that creates it. The MhSnapperShape
is stored in the shape
field on MhSnapper
.
MhBehavior
The MhBehavior
class holds a specific piece of functionality for an MhSnapper
such as graphics, snapping, parts, or any other functionality usually contained within the Snapper
class. There are many pre-defined behavior classes in the abstract which are used to isolate specific functionality. For example, the MhGenericGfxBehavior
should be used for behaviors relating to Snapper
graphics. Behaviors are added to an MhSnapper
by the MhSnapperSpawner
that creates it.
Creating MhSnapper
s
The MhSnapperSpawner
is responsible for creating and configuring MhSnapper
s. MhSnapperSpawner
is used by the both the library, for a user to insert an MhSnapper
as well as by the MhEngine
and its MhSystemEngineFunction
s to generate MhSnapper
s automatically. MhSnapperSpawner
s populate the snapper spawned with the appropriate MhSnapperShape
and MhBehavior
s to spawn the object that the spawner inserts.
Child Snappers
The abstract uses child snappers, which are snappers that are stored on other snappers, to represent objects in a material handling system which are composed of many separate objects. MhSnapper
may have many child snappers representing the objects that compose it. The SnapperRelationship
class is used to determine the functionality of child snappers and their relationship to their parent snapper. The SnapperRelationship
is provided to the MhSnapper
by the MhSnapperSpawner
that creates it. The SnapperRelationship
is used to determine the specifics of Snapper
adoption.
Comments
0 comments
Please sign in to leave a comment.