Package schrodinger :: Package graphics3d :: Module common :: Class Group
[hide private]
[frames] | no frames]

Class Group

object --+
         |
        Group


Class to group a bunch of primitives and draw them out.  

Example for non-Maestro objects:

    my_box1 = box.Box(...)
    my_box2 = box.Box(...)
    my_sphere = sphere.Sphere(...)
    
    my_group = box.Group()  (or sphere.Group(), etc)
    my_group.add(my_box1)
    my_group.add(my_box2)
    my_group.add(my_sphere)

    # The following draw invocation would be in a separate
    # callback function registered with workspace_draw_function_add()
    my_group.draw()

Instance Methods [hide private]
 
__init__(self)
Constructor takes no arguments.
 
__del__(self)
 
__len__(self)
Return the number of primitives in this group.
 
getTotalTypes(self)
Return the number of unique primitive types in this group.
 
draw(self)
Invoke each item's drawing method
 
hide(self)
Do not draw objects belonging to this group.
 
show(self)
Cancel effect of hide() method, and draw the objects belonging to this group.
 
add(self, item)
Add a drawing primitive instance (Box, etc.) to this group.
 
remove(self, item)
Remove a drawing primitive instance (Box, etc.) from this group.
 
clear(self, item_type=None)
Clear up drawing instances.
 
boundingBoxCallback(self, r00, r01, r02, r03, r10, r11, r12, r13, r20, r21, r22, r23, r30, r31, r32, r33)
Called when the workspace is fit to screen
 
_handleOpenGLLevelChange(self)
Iterate over all the objects in this group.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

 

Constructor takes no arguments.

Overrides: object.__init__

__len__(self)
(Length operator)

 

Return the number of primitives in this group. Note that each primitive type can have multiple instances registered and each of these is counted towards the total.

getTotalTypes(self)

 

Return the number of unique primitive types in this group. This differs from the standard length operation. That returns a count of all primitive instances.

draw(self)

 

Invoke each item's drawing method

The script should always call this method when the Workspace is drawn for every group it creates.

To hide the group so that it does not get drawn, use hide() method.

hide(self)

 

Do not draw objects belonging to this group. Will also modify Maestro's bounding rect to exclude these objects.

show(self)

 

Cancel effect of hide() method, and draw the objects belonging to this group. Will modify Maestro's bounding rect to exclude these objects.

clear(self, item_type=None)

 

Clear up drawing instances.

Arguments:
item_type: Can be one of the following: None, Arrow, Box, etc.

Note:
- If item_type is None, all drawing instances will be removed; if
  item_type is not None, all drawing instances of the `item_type' class
  will be removed.
- No effects if there is no drawing instances of the `item_type' class.

_handleOpenGLLevelChange(self)

 

Iterate over all the objects in this group. For each object that can handle a level change regenerate the object automatically. Support or lack thereof is determined by presence or lack of a handleOpenGLLevelChange() method.

This is a private function and should not be called by users.