ftp.nice.ch/pub/next/science/mathematics/HippoDraw.2.0.s.tar.gz#/HippoDraw/Hippo.bproj/Plot1D.m

This is Plot1D.m in view mode; [Download] [Up]

/* Plot1D.m	By Paul Kunz	March 1992
 * Replacement of obsolete class used for backward compatiblity.
 *
 * Copyright (C)  1991  The Board of Trustees of  
 * The Leland Stanford Junior University.  All Rights Reserved.
 */

#import "Plot1D.h"

const char Plot1D_h_rcsid[] = PLOT1D_H_ID;
const char Plot1D_m_rcsid[] = "$Id: Plot1D.m,v 2.6.2.1 1994/02/08 20:30:21 rensing Exp $";

#define DEF_PLOT_SIZE 260.0

@implementation Plot1D

- init
{
    [super init ];
    bounds.origin.x = 0.0;
    bounds.origin.y = 0.0;
    bounds.size.width = DEF_PLOT_SIZE;
    bounds.size.height = DEF_PLOT_SIZE;
    return self;
}
- replaceWithImage
{
    id			plot, plot2;
    cutStorElem		cut;
    int			i, count;
    
    plot = [[Plot allocFromZone:[self zone]] init];
    [plot setBounds:&bounds];
    [plot setHTuple:nil withDisplay:disp];
    [plot setRefFlag:refFlag];
    [plot setFixBinsFlag:fixBinsFlag];
    [plot setRefFilename:reffilename];
    [plot setCutHistFlag:cutHistFlag];
    if ( cutHistFlag ) {
	 [plot initCutParmsForColumn: cutParms.varIndex];
	 [plot setCutLow:cutParms.cutValue1 High:cutParms.cutValue2];
    }
    count = [cutPlotStor count];
    for ( i = 0; i < count; i ++ ) {
        cut.plot = [ cutPlotStor elementAt:i];
	[plot addCutPlot: cut.plot];
    }
    count = [dependList count];
    for ( i = 0; i < count; i ++ ) {
        plot2 = [dependList objectAt:i];
	[plot addCutDepend:plot2];
    }
    disp = NULL;
    [self free];
    return plot;
}
  
- read:(NXTypedStream *) ts
{
    id			plot;
    cutStorElem		cut;
    ntuple		*ntlist;
    display		*dlist;
    char		*data;
    int			len, lenref;
    int			i, count;
    
    [super read:ts];
    NXReadTypes( ts, "ccii",    &refFlag, &fixBinsFlag, &len, &lenref);
    NX_ZONEMALLOC( [self zone], data, char, len );
    NX_ZONEMALLOC( [self zone], reffilename, char, lenref+1 );
    NXReadType(  ts, "*",       &reffilename);
    NXReadArray( ts, "c",       len, data );
    h_readMem( data, len,  &dlist, &ntlist );
    NXZoneFree( [self zone], data );
    disp = dlist[0];
    h_bindNtuple(disp, NULL);
    NXReadType(  ts, "c",      &cutHistFlag );
    if ( cutHistFlag ) {
        NXReadType( ts, "i",       &len );
	NX_ZONEMALLOC( [self zone], cutParms.cutFunc, char, len+1 );
	NXReadType( ts, "{*iffi}", &cutParms ); 
	NXReadType( ts, "i",       &cutNumber);
    }
    NXReadType(  ts, "i",       &count );
    if ( count ) {
        cutPlotStor = [[Storage allocFromZone:[self zone]] initCount:0
    			             elementSize:sizeof(cutStorElem)
			             description:"@*"];
    }
    for ( i = 0; i < count; i++ ) {
        cut.plot = NXReadObject( ts );
	if ( cut.plot ) {
	    [cutPlotStor addElement:&cut.plot];
	}
    }
    NXReadType( ts, "i", &count );
    if ( count ) {
        dependList = [[List allocFromZone:[self zone]] initCount:0];
    }
    for ( i = 0; i < count; i++ ) {
        plot = NXReadObject( ts );
	if ( plot ) {
	    [dependList addObject:plot];
	}
    }
    return self;
}
- free
{
    NXZoneFree([self zone], reffilename );
    NXZoneFree([self zone], cutParms.cutFunc );
    return [super free];
}
@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.