home *** CD-ROM | disk | FTP | other *** search
/ Nebula / nebula.bin / SourceCode / Classes / ContourView / CVtestApp.m < prev    next >
Text File  |  1992-12-03  |  2KB  |  87 lines

  1. /* Test application for ContourView.m class */
  2. /* Izumi Ohzawa 92-5-22 */
  3.  
  4. #import "CVtestApp.h"
  5. #import "ContourView.h"
  6. #import <appkit/Slider.h>
  7. #import <appkit/Button.h>
  8. #import <stdio.h>
  9. #import <math.h>
  10.  
  11. #define PI    3.141592654
  12.  
  13. extern float fdata[];    /* %%%%%%%%%%%%% Data are here %%%%%%%%%%%%%%%%%% */
  14.  
  15. @implementation CVtestApp
  16.  
  17. -appDidInit:sender
  18. {
  19.  
  20.     [brightCWell setColor:NX_COLORRED];
  21.     [darkCWell setColor:NX_COLORBLUE];
  22.     [bgCWell setColor:NX_COLORWHITE];
  23.     [self colorWellsAction:self];    // reflect color well settings
  24.  
  25.     /* - setCartesianGridData:(float *)f :(float)xmin :(float)xmax
  26.                   :(float)ymin :(float)ymax
  27.                   ofSize:(int)nx :(int)ny
  28.                   withInterpolationTo:(int)n1x :(int)n1y; */
  29. //    [contourView setDebugEnable:YES];
  30.  
  31.     [contourView setCartesianGridData: fdata :1.0 :5.0 :1.0 :5.0
  32.                 ofSize: 20 :20
  33.                 withInterpolationTo: 50 :50];
  34.     [contourView setFillEnable:YES];
  35.     [contourView display];
  36.     return self;
  37. }
  38.  
  39. - setNcontourLevels:sender
  40. {
  41. static int new, old=16;
  42.     new = [sender intValue]/2 *2;    // force to even number
  43.     if(new == old) return self;
  44.     old = new;
  45.     [nlevelField setIntValue:new];
  46.     [contourView setNumberOfContourLevels:new];
  47.     [contourView display];
  48.     return self;
  49. }
  50.  
  51.  
  52. - clearAction:sender
  53. {
  54.     [contourView clear:self];
  55.     return self;
  56. }
  57.  
  58. - drawAction:sender
  59. {
  60.     [contourView display];
  61.     return self;
  62. }
  63.  
  64. - colorWellsAction:sender
  65. {
  66. NXColor cB, cD, cBG;
  67.     cB =[brightCWell color];
  68.     cD =[darkCWell color];
  69.     cBG = [bgCWell color];
  70.     [contourView setFillColors:cB :cD];
  71.     [contourView setBackgroundColor:cBG];
  72.     [contourView display];
  73.     return self;
  74. }
  75.  
  76. - useColorAction:sender
  77. {
  78. int state;
  79.     state = [sender state];
  80.     [contourView setFillEnable:(BOOL)state];
  81.     [contourView display];
  82.     return self;
  83. }
  84.  
  85.  
  86. @end
  87.