home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Stuff / 3D_Reality / 3D_Reality_API / Examples / Patch.bproj / PatchInspector.m < prev    next >
Encoding:
Text File  |  1992-10-09  |  2.2 KB  |  86 lines

  1.  
  2. /* PatchInspector.m    Peter Wickersham 
  3.  * 
  4.  * Methods for PatchInspector class.
  5.  *
  6.  */
  7.  
  8. #import "../Stone3DAPI/Stone3D.h"
  9.  
  10. #import "PatchInspector.h"
  11. #import "Patch.h"
  12.  
  13. @implementation PatchInspector
  14.  
  15. // loadShape:inView is a method declared in Inspector3D to provide the 
  16. // inspector with a place to initialize its interface objects and any
  17. // other internal initialization that it might need to do.  Here, I set
  18. // my interface objects according to how Patch wants them to be defaulted.
  19. - loadShape:(Shape *)shape inView:(Camera *)camera
  20. {
  21.     // Perform superclass method first
  22.     [super loadShape:shape inView:camera];
  23.     if (shape) {
  24.     if ([shape isKindOf:[Patch class]]) {
  25.         // Set the states of the interface objects by getting the
  26.         // info from Patch.
  27.         [pointsVisibleSwitch setState:
  28.                     [(Patch *)shape controlVisible]];
  29.         [hullVisibleSwitch setState:
  30.                     [(Patch *)shape hullVisible]];
  31.         setTitle(uBasisButton,[(Patch *)shape uBasis]);
  32.         setTitle(vBasisButton,[(Patch *)shape vBasis]);
  33.     }
  34.     }
  35.     return self;
  36. }
  37.  
  38. // Theses methods are for changing certain characteristics about the 
  39. // currently selected shape. Using the selectedShape method defined 
  40. // in PatchInspector's superclasses lets us get the id of the selected Patch.
  41. // Then we use the inherited method displayChanges to redraw the shapes.
  42.  
  43. - changePointsVisible:sender
  44. {   
  45.     Shape *shape = [self selectedShape];
  46.     if (shape && [shape isKindOf:[Patch class]]) {
  47.     [(Patch *)shape setControlVisible:[sender state]];
  48.     [self displayChanges];
  49.     }
  50.  
  51.     return self;
  52. }
  53.  
  54. - changeHullVisible:sender
  55. {
  56.     Shape *shape = [self selectedShape];
  57.     if (shape && [shape isKindOf:[Patch class]]) {
  58.     [(Patch *)shape setHullVisible:[sender state]];
  59.     [self displayChanges];
  60.     }
  61.  
  62.     return self;
  63. }
  64.    
  65.  
  66. - setUBasis:sender
  67. {
  68.     Shape *shape = [self selectedShape];
  69.     if (shape && [shape isKindOf:[Patch class]]) {
  70.     [(Patch *)shape setUBasis:[sender selectedTag]];
  71.     [self displayChanges];
  72.     }
  73.     return self;
  74. }
  75.  
  76. - setVBasis:sender
  77. {
  78.     Shape *shape = [self selectedShape];
  79.     if (shape && [shape isKindOf:[Patch class]]) {
  80.     [(Patch *)shape setVBasis:[sender selectedTag]];
  81.     [self displayChanges];
  82.     }
  83.     return self;
  84. }
  85.  
  86. @end