Monday, October 13, 2008

The ItemHandle Class

The ItemHandle is a class that stores everything about a model object. 

The three important aspects of a model object are:
  • The graphics items, e. g. the part graphics item, text graphics items, etc. This allows more than one graphical item to represet the same model object, e. g. aliases, dimers, decorations. 
  • The item data: contains two hash tables, one for numerical data tables and one for text data tables. The hash tables store information relating to the model object. Some examples for the hash table keys are "Numerical Attributes", "Text Attributes", "Functions", etc. These tables are usually inserted into the objects by Tools (plug-ins).
  • Item family: classifies the model item as belonging to a particular family.  The two main types of families are PartFamily and ConnectionFamily
The following aspects of an object are more important for interface rather than defining a model object:
  • List of graphical tools associated with an object item. 
  • List of tools that are associated with an object item.
Each ItemHandle has one parent. Several convenient functions are available such as:
  • root(), which gets the top-most parent
  • parentOfFamily(), which gets the lowest level parent that belongs to the given family
  • setParent(), self-explanatory
  • isChildOf(), which checks if this item handle is a child of the given handle
  • isA(), which checks whether this handle belongs in the given family

The two main subclasses of ItemHandle are PartHandle and ConnectionHandle. PartHandle always has a PartHandle as a parent. ConnectionHandle always has a ConnectionHandle as a parent. 

No comments: