Last modified 3 August 2003 by jdavis@math.wisc.edu
Conforms to NSObject
The SMKManagedDrawing protocol defines those objects that can be managed by an SMKDrawingManager. Its first two methods let the drawing manager sort its managed objects by depth.
- (double)managedDrawerDepth;Returns the depth of the receiver in eye coordinates. This depth should be between 0 and 1, with 0 being close to the viewer and 1 far away.
- (NSComparisonResult)compareWithManagedDrawer:(id <SMKManagedDrawing>)other;
Compares the receiver's depth with that of other, returning NSOrderedDescending if other's depth is greater, NSOrderedAscending if the receiver's depth is greater, and NSOrderedSame if the depths are equal.
Typically, the compareWithManagedDrawer: method will be implemented like this:
- (NSComparisonResult)compareWithManagedDrawer:(id <SMKManagedDrawing>)other
{
double myDepth, otherDepth;
myDepth = [self managedDrawerDepth]
otherDepth = [other managedDrawerDepth];
if (otherDepth > myDepth)
return NSOrderedDescending;
else
if (otherDepth < myDepth)
return NSOrderedAscending;
else
return NSOrderedSame;
}
A third method lets the drawing manager tell the managed object to draw itself. A fourth method is used by the drawing manager for selection of 2D objects.
- (id)drawManagedDrawer;Draws and returns the receiver.
- (BOOL)managedDrawerContainsPoint:(NSPoint)point;
Returns YES if and only if the receiver contains the given 2D point. Only 2D objects should ever return YES, since 3D selection is handled separately.