/* Test application for ContourView.m class */
/* Izumi Ohzawa 92-5-22 */

#import "CVtestApp.h"
#import "ContourView.h"
#import <appkit/Slider.h>
#import <appkit/Button.h>
#import <stdio.h>
#import <math.h>

#define PI	3.141592654

extern float fdata[];	/* %%%%%%%%%%%%% Data are here %%%%%%%%%%%%%%%%%% */

@implementation CVtestApp

-appDidInit:sender
{

    [brightCWell setColor:NX_COLORRED];
    [darkCWell setColor:NX_COLORBLUE];
    [bgCWell setColor:NX_COLORWHITE];
    [self colorWellsAction:self];	// reflect color well settings

    /* - setCartesianGridData:(float *)f :(float)xmin :(float)xmax
				  :(float)ymin :(float)ymax
				  ofSize:(int)nx :(int)ny
				  withInterpolationTo:(int)n1x :(int)n1y; */
//    [contourView setDebugEnable:YES];

    [contourView setCartesianGridData: fdata :1.0 :5.0 :1.0 :5.0
				ofSize: 20 :20
				withInterpolationTo: 50 :50];
    [contourView setFillEnable:YES];
    [contourView display];
    return self;
}

- setNcontourLevels:sender
{
static int new, old=16;
    new = [sender intValue]/2 *2;	// force to even number
    if(new == old) return self;
    old = new;
    [nlevelField setIntValue:new];
    [contourView setNumberOfContourLevels:new];
    [contourView display];
    return self;
}


- clearAction:sender
{
    [contourView clear:self];
    return self;
}

- drawAction:sender
{
    [contourView display];
    return self;
}

- colorWellsAction:sender
{
NXColor cB, cD, cBG;
    cB =[brightCWell color];
    cD =[darkCWell color];
    cBG = [bgCWell color];
    [contourView setFillColors:cB :cD];
    [contourView setBackgroundColor:cBG];
    [contourView display];
    return self;
}

- useColorAction:sender
{
int state;
	state = [sender state];
	[contourView setFillEnable:(BOOL)state];
	[contourView display];
	return self;
}


@end
