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

This is Plot.h in view mode; [Download] [Up]

/* Plot.h  by Jonas Karlsson, July 1990 
 *
 * Copyright (C)  1991  The Board of Trustees of
 * The Leland Stanford Junior University. All Rights Reserved.
 */
 
#define PLOT_H_ID "$Id: Plot.h,v 2.33.2.4 1994/02/08 20:30:09 rensing Exp $"

#import <appkit/appkit.h>
#import "Draw.subproj/Graphic.h"
#import "hippo.h"
#import "HTuple.h"

typedef struct cutParmType_t  
{
    char               *cutFunc;
    int                 varIndex;
    float               cutValue1;
    float               cutValue2;
    int                 cutCode;
    int			blkSize;
} cutParmType;

typedef struct cutStorElem_t {
    id		plot;
    NXAtom	name;
    func_id	function;
    BOOL	invertFlag;
    } cutStorElem;
    
typedef struct dependStorElem_t {
    id		plot;
    NXAtom	name;
    } dependStorElem;
    
@interface Plot:Graphic
{
    id		graphicView;	/* The View object in which drawing is done */
    id		hTuple;		/* HTuple object for ntuple bound to display */
    display     disp;
    BOOL        cutHistFlag;
    char        *reffilename;	/* filename of tuple referenced */
    int		ntindex;	/* index to n-tuple in file */
    BOOL        refFlag;	/* reference state before archiving */
    BOOL        fixBinsFlag;	/* fixed bins state before archiving */
    NXAtom	uniqueName;	/* unique name of plot */
    
 /* data on plots used to make cut on this plot */
    id		cutPlotStor;	/* Storage for cut Plots and func.*/
    id		cutPlotList;	/* temporary List of cut Plots */
    
 /* data used by Plot used for a Cut */
    id		dependStor;	/* List of dependent Plots */
    id		dependList;	/* temporary List of dependent Plots */
    cutParmType cutParms;
    int         cutNumber;	/* No longer used, but archived */

  /* data used by Plot for functions */
    List	*funcList;	/* List of functions or nil */
    id		inspector;

  /* Flag used by Fit Inspector */
    BOOL	isFitted;	/* YES if plot has not changed under fit */
}


+ initialize;
 /*
  * Class initializer.   Sets version number of Class.
  */
  
- init;

- initPlotWithTuple: (HTuple *)ht Type: (graphtype_t) type;

- (const char *)name;
 /*
  * Retruns the unique name for the receiving object
  */
  
- setGraphicView:anObject;
  /*
   * Sets the graphic View object of the receiver.
   */
   
- graphicView;
 /*
  * Returns the view that receiving object is being displayed in.
  */
- setInspector:(id)anInspector;
- inspector;
- setHTuple: ht withDisplay:(display) d1;
  /* Sets the ntuple handler and display hippo structures */
  
- setRefFilename:(const char *)filename;
 /*
  * Sets the name of the reference n-tuple file
  */
  
- changeRefFileNameIfValid:(const char *)filename;
 /*
  * Change the reference file name if it is a valid change.   A 
  * valid change is one in which the n-tuple for the plot did not
  * come from a file, i.e. it either came from pasteboard or from
  * another part of the application.
  */
  
- setDispType:(graphtype_t *) type;

- closeTuple;
  /*
   * Un-binds the display from the n-tuple.
   */
   
- bindReference;
  /*
   * Attempts to bind the plot and its display to ntuple using its archived
   * reference filename.  This method is used for inserting a plot
   * when reading document or when pasting from PasteBoard.
   */
      
- setRefFlag:(BOOL) refFlag;
  /*
   * Sets state of display's ntuple reference
   */
   
- setFitted:(BOOL) fitFlag;
  /*
   * Sets state of flag to show if plot matches fitted curve
   */
   
- (BOOL)isFitted;
  /*
   * Returns flag to show if plot matches fitted curve
   */
   
- setFixBinsFlag:(BOOL)flag;
 /*
  * Sets the fixed bins flag.
  */
  
- replaceTupleWith: ht;
  /* Replaces the tuple handler of the display with new handler n1.
   */
   
- replace:oldTuple with:newTuple;
 /*
  * If oldTuple is the HTuple object for receiving Plot, then it
  * is replaced with newTuple.   returns self;
  */
  
- hTuple;
  /*
   * Returns the n-tuple handler object for display.
   */
   
- (ntuple) ntuple;
  /* Returns the ntuple */

- addHTupleToList:tlist;
  /*
   * Adds the receiving object's hTuple to list tlist.
   */
   
- addPlotToList:list;
  /*
   * Receiving plot adds itself to the List list.
   */
   
- (display) histDisplay;
  /* Returns the Hippo display */
  
- NameAxisX:(const char *)AxisName;
- NameAxisY:(const char *)AxisName;
- NameAxisZ:(const char *)AxisName;
- NameAxisW:(const char *)AxisName;
- NameAxisXE:(const char *)AxisName;
- NameAxisYE:(const char *)AxisName;
 /*
  * Set the label of the axes.
  */

- (const char *) axisLabelX;
 /*
  * Returns the x-axis label
  */

- (const char *) axisLabelY;
 /*
  * Returns the y-axis label
  */

- (const char *) axisLabelZ;
 /*
  * Returns the z-axis label
  */

- bindAxisX:(int *)dataDim;
  /* Binds the X axis to data dimension dataDim.
   */
   
- bindAxisY:(int *)dataDim;
  /* Binds the Y axis to data dimension dataDim.
   */
   
- bindAxisZ:(int *)dataDim;
  /* Binds the Z axis to data dimension dataDim.
   */
   
- bindAxisW:(int *)dataDim;
  /* Binds the weight to data dimension dataDim.
   */

- bindAxisXE:(int *)dataDim;
  /* Binds the X error to data dimension dataDim.
   */

- bindAxisYE:(int *)dataDim;
  /* Binds the Y error to data dimension dataDim.
   */

- setLogScale:(binding_t *)axis to:(int *)yesOrNo;
- (BOOL) isLogScaleX;
 /*
  * Returns YES if x-axis is displaying a log scale.
  */

- (BOOL) isLogScaleY;
 /*
  * Returns YES if y-axis is displaying a log scale.
  */

- (BOOL) isLogScaleZ;
 /*
  * Returns YES if z-axis is displaying a log scale.
  */

- setAutoScale:(binding_t *)axis to:(const int *)yesOrNo;
- setTitlesFlag:(const int *)yesOrNo;
 /*
  * Sets titles and labels drawing on or off
  */

- (int) titlesFlag;
 /*
  * Returns YES if titles and labels are being drawn
  */

- setAxesFlag:(int *)yesOrNo;
 /*
  * Sets drawing of axes on or off
  */

- (int) axesFlag;
 /*
  * Returns YES if axes are being drawn.
  */
  
- setNumBins:(binding_t *) axis to:(const int *)n;
 /*
  * Set the number of bins on axis axis to n.
  */
  
- (int) numBinsForAxis:(binding_t) axis;
- (float) widthForAxis:(binding_t) axis;
- setRange:(binding_t* ) axis to:(const NXPoint *)p;
 /* 
  * Sets the range on axis axis to low and high given as x,y of point p.
  */

- setRangeAndNbins:(binding_t* ) axis to:(const NXPoint *)p;
 /* 
  * Sets the range on axis axis to low and high given as x,y of point p.
  * Also sets a new value of nBins and adjusts range to keep binwidth the same.
  */

- getRangeForAxisX:(NXPoint *)p;
- getRangeForAxisY:(NXPoint *)p;
- getRangeForAxisY:(NXPoint *)p normalizedTo:plot;
 /*
  * Returns, by reference, the range of the y axis.   If both the receiving
  * plot and plot are of graphtype HISTOGRAM, the the returned range
  * is normalized to take into account the bin width.
  */
  
- getRangeForAxis:(binding_t) axis low:(float *) xl high:(float *) xh;
- setRangesFrom:plot;
- setRangesAndBinsFrom:plot;
 /*
  * Receiving plot sets x and y ranges to correspond to those of plot.
  * If bot plots are graphtype HISTOGRAM, then receiving plot will
  * take into account the bin width
  */
- setDrawType:(drawtype_t *) type;
- getDrawType:(drawtype_t *) type;
- setLineStyle:(linestyle_t *) style;
- getLineStyle:(linestyle_t *) style;
- setPlotSym:(plotsymbol_t *) plotsymbol;
- getPlotSym:(plotsymbol_t *) plotsymbol;
- setSymSize:(float *)plotsymsize;
- getSymSize:(float *)plotsymsize;
- setColorType:(const int *) onOff;
- (const char *) title;
  /* Returns the title of the Histogram display
   */

- setTickLocation: (binding_t *) axis to:(plotloc_t *) loc;
- setScaleLocation: (binding_t *) axis to:(plotloc_t *) loc;
- setLabelLocation: (binding_t *) axis to:(plotloc_t *) loc;
- setScaleFontSize: (binding_t *) axis to:(float *) fontSize;
- setTickLength: (binding_t *) axis to:(float *) len;
 /*
  * axis frills.
  */
  
- print;
  /* Generates line printer output to stdout
   */
   
- draw;
- setBounds:(const NXRect *)aRect;
- sizeToNaturalAspectRatio;
 /*
  * Sets size to default plot size keeping the upper left corner
  * at its current postion.
  */
  
/* Methods supporting Archiving and de-Archiving */
- write:(NXTypedStream *) ts;
- read:(NXTypedStream *) ts;
- free;
  /* frees the Hippo display (but not the tuple) and frees itself
   */

- wasRemovedFrom: gv;

@end

/* Methods dealing with cuts */

@interface Plot(Cut)

/* Methods supporting managing cutPlots to this plot */

- initCutWithTuple:ht Column:(int)i;
 /*
  * Initialize a new cut plot. Column specifies the column of the tuple to
  * cut on.
  */

- (int) addCutPlot: cutPlot;
 /*
  * Adds a plot being used to display cuts to list of cut plots and
  * returns 0 if successful.   Returns 1 if the n-tuples of the
  * receiving Plot and the cutPlot are different.
  */
  
- initCutParmsForColumn: (int)i;
 /*
  * set the cut parameters for the specified ntuple column.
  */

- bindCuts;
  /*
   * Attempts to bind the plot with its cuts, or its cut dependents.
   * Should be invoked only after all plots have been bound.
   */
   
- changeCutPlot:cutPlot;
 /*
  * Informs receiving Plot that the plot cutPlot has changed the
  * cut function parameters.   
  */
  
- cutList;
 /*
  * Returns the list of plots being used to display the cuts on the
  * receiving object.
  */
   
- (BOOL) hasCut;
 /*
  * Returns YES if a cut is being applied to the display
  */
  
- invertCutPlot:cutPlot;
 /*
  * Inverts the meaning of a cut
  */
  
- (BOOL) isInvertedCut:cutPlot;
  /*
   * Returns TRUE if give cutPlot has the invertFlag set to TRUE
   */
   
- removeAllCuts;
 /*
  * Receiving Plot removes all cuts.
  */
  
- removeCutPlot:cutPlot;
 /*
  * Receiving Plot removes cutPlot from list of plots that apply
  * cut to its display.
  */
	
/* Methods used to support plot being used for display for a cut function */
- addCutDepend:sender;
 /*
  * Receiving object adds sender to list of Plots that depends
  * on its cut control.
  */
  
- (unsigned) dependCount;
  /*
   * Returns the number of Plot objects depending on the receiving 
   * object to control its cut
   */
   
- dependList;
 /*
  * Returns a List object containing those Plots that depend on
  * receiving objects cut paramaters.
  */
  
- getCutLow:(float *)low High:(float *)high;
 /*
  * Returns the cut parameters for cut functions being displayed by
  * receiving object.
  */
  
- setCutLow:(float)low High:(float)high;
 /*
  * Sets the cut parameters for cut functions
  */
  
- (BOOL) isCutPlot;
 /*
  * Returns YES if receiving Plot is a plot that displays a cut,
  * NO otherwise.
  */
  
- removeCutDepend:sender;
 /*
  * Removes the sender from list of Plots depending on receiver's
  * cut control.
  */
  
- setCutHistFlag: (BOOL) yesOrNo;
 /*
  * Shows type of this plot. If it is a Cut Histogram, we handle it differently
  */
- (int) getCutColumn;
 /*
  * return the ntuple column being cut
  */
  
@end

/* Methods dealing with plot functions */

@interface Plot(Function)
- addFunction:aFunc;
 /*
  * Adds a Plot function to list of overlayed functions plotted
  */

- replaceDispFuncs;
 /*
  * Replaces the display's function list with new set built from
  * the function list.   This method is invoked when unarchiving
  * a document.
  */
  
- removeFunction:aFunc;
 /*
  * Removes a Plot function from the list of overlayed functions.
  */
- (BOOL) hasFunction;
 /*
  * Returns YES only if receiving Plot has any plot functions attached.
  */
  
- (List *) functionList;
 /*
  * Returns the function list for receiving Plot.
  */
  
@end

/* Methods dealing with Three D rotations */
@interface Plot(ThreeD)
- mouseMoved:(const NXPoint *)offset withKey:(int *)flag;

- reset3D;
typedef struct {
    int                 faceNo;
    float               value;
} grayValue_t;    
- newGray3D:(grayValue_t *)grayValue;
- newTheta3D:(float *)angle;
- newPhi3D:(float *)angle;
- newDist3D:(float *)distance;
- toggleCube3D:(BOOL *)state;
- toggleWireFrame3D:(BOOL *)state;
- toggleFill3D:(BOOL *)state;
- toggleMesh3D:(BOOL *)state;
@end

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