com.icdif.audio.graph
Class PlotOld

java.lang.Object
  extended by com.icdif.audio.graph.PlotOld

public class PlotOld
extends java.lang.Object

A simple class that allows to plot float[] arrays to a swing window. The first function to plot that is given to this class will set the minimum and maximum height values. I'm not that good with Swing so i might have done a couple of stupid things in here :)

Author:
wanderer

Constructor Summary
PlotOld(java.lang.String title, int width, int height)
          Instantiates a new Plot with the given title and dimensions.
 
Method Summary
 void clear()
          It clears the plot, i.e., paints the original rectangle with the background color and sets the attribute cleared to true
 void plot(java.util.ArrayList<java.lang.Float> samples, float samplesPerPixel, java.awt.Color color)
          This plots the samples, with the Window defined as parameter
 void plot(java.util.ArrayList<java.lang.Float> samples, float samplesPerPixel, float verticalOffset, boolean useLastScale, java.awt.Color color)
          This plots the samples, with the Window defined as parameter.
 void plot(float[] samples, float samplesPerPixel, java.awt.Color color)
          This plots the values passed, with the Window defined as parameter.
 void plot(float[] samples, float samplesPerPixel, float verticalOffset, boolean useLastScale, java.awt.Color color)
          This plots the samples, with the Window defined as parameter.
 void setMarker(int x, java.awt.Color color)
          Sets a marker (vertical line)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlotOld

public PlotOld(java.lang.String title,
               int width,
               int height)
Instantiates a new Plot with the given title and dimensions.

Parameters:
title - The title.
width - The width of the plot in pixels.
height - The height of the plot in pixels.
Method Detail

clear

public void clear()
It clears the plot, i.e., paints the original rectangle with the background color and sets the attribute cleared to true


plot

public void plot(float[] samples,
                 float samplesPerPixel,
                 java.awt.Color color)
This plots the values passed, with the Window defined as parameter. It updates the image initialized in the constructor.

Parameters:
samples - the samples to plot
samplesPerPixel - The number of samples in each pixel
color - The color of the line

plot

public void plot(java.util.ArrayList<java.lang.Float> samples,
                 float samplesPerPixel,
                 java.awt.Color color)
This plots the samples, with the Window defined as parameter

Parameters:
samples - the samples to plot
samplesPerPixel - The number of samples in each pixel
color - The color of the line

plot

public void plot(float[] samples,
                 float samplesPerPixel,
                 float verticalOffset,
                 boolean useLastScale,
                 java.awt.Color color)
This plots the samples, with the Window defined as parameter. It can used the scale of the last plot and a vertical offset.

Parameters:
samples - the samples to plot
samplesPerPixel - The number of samples in each pixel
verticalOffset - The vertical offSet (in order to plot several frequencies in the same image)
useLastScale - boolean that tells to user or not the last scale
color - The color of the line

plot

public void plot(java.util.ArrayList<java.lang.Float> samples,
                 float samplesPerPixel,
                 float verticalOffset,
                 boolean useLastScale,
                 java.awt.Color color)
This plots the samples, with the Window defined as parameter. It can used the scale of the last plot and a vertical offset.

Parameters:
samples - the samples to plot
samplesPerPixel - The number of samples in each pixel
verticalOffset - The vertical offSet (in order to plot several frequencies in the same image)
useLastScale - boolean that tells to user or not the last scale
color - The color of the line

setMarker

public void setMarker(int x,
                      java.awt.Color color)
Sets a marker (vertical line)

Parameters:
x - the position to set the marker
color - the colour of the marker