Iteration
All EnumerateGraphics implementations create a bidirectional, read-only iterator to iterate over the canvas graphics specified in the filter by calling MCanvasRepresentation::CreateReadIterator. This iterator is passed to the filter inside EnumerateGraphics with the SetIterator function shown below.
void TCanvasGraphicFilter::SetIterator( TCanvasGraphicReadIterator* );
const MCanvasGraphic virtual const TCanvasGraphicFilter::MCanvasGraphic* First() = 0; const MCanvasGraphic virtual const TCanvasGraphicFilter::MCanvasGraphic* Next() = 0;
Derived classes
TCanvasGraphicFilter is abstract. GrafEdit provides the following ordering, hit detection, and selection concrete filter classes.
TCanvasBackToFrontFilter: This filter iterates over the graphics in the representation from back to front. This is useful for drawing graphics with a painters algorithm (from back to front).
TCanvasFrontToBackFilter: This filter iterates over graphics in the representation from front to back, which is a good order for hit detection because if the graphic on top is hit, there is no need to test the graphics beneath.
The following filters pass the funnel to the canvas graphics in the representation, as well as to the selection feedback graphic (which is also a canvas graphic). The selection feedback graphic is created as needed by the selection filter to represent the visual feedback that identifies the current selection. The selection feedback graphic is destructed by the filter after the funnel has processed it. These filters derive from TCanvasSelectionFilter.
TCanvasTopSelectionHitDetectionFilter: This filter is constructed from a canvas selection. The filter iterates over the graphics in the selection from front to back and returns a TSRTFeedback instance for them. It then iterates all graphics in the representation (not just those in the selection) front to back and returns each graphic in turn. This filter algorithm is useful in hit detection when you want to know whether the end user clicked on the selection feedback graphic or on the canvas graphic. For example, if you have a graphic-specific interactor, the feedback graphic should be included in the hit detection because the feedback graphic provides interactive potential beyond that of the selected canvas graphic.
TCanvasTopSelectionDrawingFilter: This function is constructed from a canvas selection. The filter iterates over the graphics in the representation from back to front and returns a TSRTFeedback instance for them. This filter algorithm is useful for drawing with a painters algorithm (from back to front) when you want to include the selection feedback graphic. You might want to derive from TCanvasTopSelectionDrawingFilter to create similar filters with custom selection strategies.
Ordering
Hit detection and selection
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Generated with WebMaker