Class graph.VectorSet
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class graph.VectorSet
java.lang.Object
   |
   +----graph.DataSet
           |
           +----graph.VectorSet
  -  public class VectorSet
  -  extends DataSet
This class is designed to hold vectors to be plotted. It extends the 
 DataSet class.
 The vectors are defined as (x,y,dx,dy) where (x,y) is the position
 of the vector tail and (dx,dy) is the relative position of the head.
 It is to be used in conjunction with the Graph2D class and Axis 
 class for plotting 2D graphs.
  -  Version:
  
-  1.3, 1996/10/23 03:30:22
  
-  Author:
  
-  Leigh Brookshaw
   
  -   MAXIMUM MAXIMUM
-  A constant value flag used to specify if the max magnitude of the
vectors is going to be used as the scaling variable
  
-   MEAN MEAN
-  A constant value flag used to specify if the mean magnitude of the
vectors is going to be used as the scaling variable
  
-   MINIMUM MINIMUM
-  A constant value flag used to specify if the minimum magnitude of the
vectors is going to be used as the scaling variable
  
-   scale scale
-  This is the scaling to be used when drawing vectors.
  
-   scalingType scalingType
-  The flag specifying which scaling variable to use
  
-   stride stride
-  This is the stride of the data in the data array.
   
  -   VectorSet() VectorSet()
-   Instantiate an empty data set.
  
-   VectorSet(double) VectorSet(double)
-   Instantiate an empty data set.
  
-   VectorSet(double[], int) VectorSet(double[], int)
-  Instantiate a DataSet with the parsed data.
  
-   VectorSet(double[], int, double) VectorSet(double[], int, double)
-  Instantiate a DataSet with the parsed data.
   
  -   draw_data(Graphics, Rectangle) draw_data(Graphics, Rectangle)
-  Draw the vectors at the data points.
  
-   draw_legend(Graphics, Rectangle) draw_legend(Graphics, Rectangle)
-  Draw a legend for this Vector set
  
-   drawVectors(Graphics, Rectangle) drawVectors(Graphics, Rectangle)
-  
  
-   getScaleFactor() getScaleFactor()
-   return the current scaling factor.
  
-   legend() legend()
-  Draw a Vector legend in the graph window.
  
-   legend(double, double, String) legend(double, double, String)
-  Define a Vector legend in the graph window
  
-   legend(int, int, String) legend(int, int, String)
-  Define a Vector legend in the graph window
  
-   legend(String) legend(String)
-  Define a Vector legend in the graph window.
  
-   range(int) range(int)
-  Calculate the range of the data and the magnitude of the vectors.
  
-   setScale(double) setScale(double)
-  Set the scaling to use when drawing vectors
  
-   setScalingType(int) setScalingType(int)
-  Set the scaling type to use when drawing vectors
   
 MEAN
MEAN
  public final static int MEAN
  -  A constant value flag used to specify if the mean magnitude of the
vectors is going to be used as the scaling variable
 MINIMUM
MINIMUM
  public final static int MINIMUM
  -  A constant value flag used to specify if the minimum magnitude of the
vectors is going to be used as the scaling variable
 MAXIMUM
MAXIMUM
  public final static int MAXIMUM
  -  A constant value flag used to specify if the max magnitude of the
vectors is going to be used as the scaling variable
 scale
scale
  public double scale
  -  This is the scaling to be used when drawing vectors. The scaling is the
fraction of the axis the mean vector magnitude will be scaled to.
 stride
stride
  protected int stride
  -  This is the stride of the data in the data array. For a vector set
it will be 4.
 scalingType
scalingType
  protected int scalingType
  -  The flag specifying which scaling variable to use
   
 VectorSet
VectorSet
  public VectorSet() throws Exception
  -  Instantiate an empty data set.
  
    -  Throws: Exception
    
-  A Generic exception if it fails to instantiate the
           the class with the correct stride.
  
 
 VectorSet
VectorSet
  public VectorSet(double d[],
                   int n) throws Exception
  -  Instantiate a DataSet with the parsed data.
The double array contains the data. 
The data is stored in the array in the sequence
            x,y,dx,dy,x,y,dx,dy,...
Where (x,y) is the position of the tail and (dx,dy) is the relative
position of the head.
This means that the length of the data
array is 4*n.
    -  Parameters:
    
-  d - Array containing the (x,y,dy,dx) vectors.
    -  n - Number of (x,y) data pairs in the array.
    
-  Throws: Exception
    
-  A Generic exception if it fails to load the
           parsed array into the class.
  
 
 VectorSet
VectorSet
  public VectorSet(double scale) throws Exception
  -  Instantiate an empty data set.
  
    -  Parameters:
    
-  s - The scaling to use when plotting the vectors.
    
-  Throws: Exception
    
-  A Generic exception if it fails to instantiate the
           the class with the correct stride.
  
 
 VectorSet
VectorSet
  public VectorSet(double d[],
                   int n,
                   double scale) throws Exception
  -  Instantiate a DataSet with the parsed data.
  
    -  Parameters:
    
-  d - Array containing the (x,y,dy,dx) vectors.
    -  n - Number of (x,y,dx,dy) vectors in the array.
    
-  Throws: Exception
    
-  A Generic exception if it fails to load the
           parsed array into the class.
  
 
   
 setScale
setScale
  public void setScale(double scale)
  -  Set the scaling to use when drawing vectors
  
    -  Parameters:
    
-  scale - The scaling to employ
  
 
 setScalingType
setScalingType
  public void setScalingType(int type)
  -  Set the scaling type to use when drawing vectors
  
    -  Parameters:
    
-  type - Either MEAN, MAXIMUM or MINIMUM.
  
 
 getScaleFactor
getScaleFactor
  public double getScaleFactor()
  -  return the current scaling factor. That is the calculated scaling
 using the axis range the mean/max/min magnitude and the percentage
 scale.
 legend
legend
  public void legend()
  -  Draw a Vector legend in the graph window. The legend will be placed
above the data window in the center
 legend
legend
  public void legend(String text)
  -  Define a Vector legend in the graph window. The legend will be placed
above the data window in the center
  
    -  Parameters:
    
-  text - text to display in the legend
  
 
 legend
legend
  public void legend(int x,
                     int y,
                     String text)
  -  Define a Vector legend in the graph window
  
    -  Parameters:
    
-  x - pixel position of the legend.
    -  y - pixel position of the legend.
    -  text - text to display in the legend
    
-  Overrides:
    
-  legend in class DataSet
  
 
 legend
legend
  public void legend(double x,
                     double y,
                     String text)
  -  Define a Vector legend in the graph window
  
    -  Parameters:
    
-  x - data position of the legend.
    -  y - data position of the legend.
    -  text - text to display in the legend
    
-  Overrides:
    
-  legend in class DataSet
  
 
 draw_data
draw_data
  public void draw_data(Graphics g,
                        Rectangle bounds)
  -  Draw the vectors at the data points.
If this data has been attached to an Axis then scale the data
based on the axis maximum/minimum otherwise scale using
the data's maximum/minimum
  
    -  Parameters:
    
-  g - Graphics state
    -  bounds - The data window to draw into
    
-  Overrides:
    
-  draw_data in class DataSet
  
 
 draw_legend
draw_legend
  protected void draw_legend(Graphics g,
                             Rectangle w)
  -  Draw a legend for this Vector set
  
    -  Parameters:
    
-  g - Graphics context
    -  w - Data Window
    
-  Overrides:
    
-  draw_legend in class DataSet
  
 
 drawVectors
drawVectors
  protected void drawVectors(Graphics g,
                             Rectangle w)
 range
range
  protected void range(int stride)
  -  Calculate the range of the data and the magnitude of the vectors.
This modifies dxmin,dxmax,dymin,dymax
and xmin,xmax,ymin,ymax
  
    -  Overrides:
    
-  range in class DataSet
  
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index