Planning for Multiple Reactors

Visual LISP

 
Planning for Multiple Reactors
 
 
 

Users may have several garden paths on the screen, and may be erasing more than one. You need to plan for this possibility.

The reactor associated with an entity is an object reactor. If there are several entities in the drawing, there may also be several object reactors, one for each entity. A specific editing event, such as the erase command, can trigger many callbacks, depending on how many of the selected entities have reactors attached. Editor reactors, on the other hand, are singular in nature. Your application should only attach a single :vlr-commandEnded event reactor.

The event sequence for both modifications—changing a vertex location and erasing a polyline—ends up with actions that need to be performed within the gp:command-ended function. Determine which set of actions to perform for each condition. The following pseudo-code outlines the logic:

Defun gp:command-ended (2nd version)
 Retrieve the pointer to the polyline (from a global variable)
 Conditional:
 If the polyline has been modified then:
 Erase the tiles
 Get information on the previous polyline vertex locations
 Get information on the new polyline vertex locations
 Redefine the polyline (straighten it up)
 Redraw the tiles
 End conditional expression
 If the polyline has been erased then:
 Erase the tiles
 End conditional expression
 End Conditional
End function