Logo Search packages:      
Sourcecode: wims version File versions

ptolemy::plot::EditablePlot Class Reference

Inheritance diagram for ptolemy::plot::EditablePlot:

ptolemy::plot::Plot ptolemy::plot::PlotBox

List of all members.

Detailed Description

This extension of Plot permits interactive modification of plotted data, one dataset at a time. By default, you can modify dataset number zero (the first one given). To change this default, call setEditable(). To edit a plot, use the right mouse button. Click and drag to the left to trace out new values for the data. To read back the modified data, use getData(). To undo a change to the data, type Control-Z. To redo the change, type Control-Y. The undo history is infinite.

The style of editing is very particular. This class assumes the data specify a function of x. I.e., there there is exactly one y value for every x value. Thus, with the right mouse button, you are allowed to trace out new y values starting with some leftmost x value. You can only trace values to the right. This feature makes it easy to trace values with discontinuities. Just start at the left, and drag to the right to the point of the discontinuity, then drag to the left, then right again. You will have to try it... Notice that this style of editing probably does not make sense with error bars, since there is no mechanism for editing the error bars.

To be able to modify the data in a dataset, of course, there must be data in the dataset. Thus, you should create a dataset (for example by calling addPoint()) before editing it. Only the visible part of the dataset can be edited (that is, the portion of the dataset along the visible part of the horizontal axis). If you zoom in, then, you can edit particular points more precisely.

To be notified when the user sketches a new signal, create an object that implements the EditListener interface and add that listener using addEditListener().

Edward A. Lee
EditablePlot.java,v 1.39 2007/12/06 18:23:51 cxh Exp
Ptolemy II 0.4 .ProposedRating Red (cxh) .AcceptedRating Red (cxh)

Definition at line 84 of file EditablePlot.java.

Public Member Functions

void addEditListener (EditListener listener)
synchronized void addLegend (int dataset, String legend)
synchronized void addPoint (final int dataset, final double x, final double y, final boolean connected)
synchronized void addPointWithErrorBars (final int dataset, final double x, final double y, final double yLowEB, final double yHighEB, final boolean connected)
synchronized void addXTick (String label, double position)
synchronized void addYTick (String label, double position)
synchronized void clear (boolean axes)
synchronized void clear (final int dataset)
synchronized void clear (final boolean format)
synchronized void clearLegends ()
void deferIfNecessary (Runnable action)
 EditablePlot ()
synchronized void erasePoint (final int dataset, final int index)
synchronized void export (OutputStream out)
synchronized BufferedImage exportImage (BufferedImage bufferedImage)
synchronized BufferedImage exportImage (BufferedImage bufferedImage, Rectangle rectangle, RenderingHints hints, boolean transparent)
synchronized BufferedImage exportImage (Rectangle rectangle)
synchronized BufferedImage exportImage ()
synchronized void fillPlot ()
boolean getColor ()
Color[] getColors ()
boolean getConnected ()
double[][] getData (int dataset)
String getDataurl ()
URL getDocumentBase ()
boolean getGrid ()
boolean getImpulses ()
synchronized String getLegend (int dataset)
synchronized int getLegendDataset (String legend)
synchronized String getMarksStyle ()
int getMaxDataSets ()
synchronized int getNumDataSets ()
Rectangle getPlotRectangle ()
synchronized Dimension getPreferredSize ()
boolean getReuseDatasets ()
synchronized String getTitle ()
synchronized double[] getXAutoRange ()
synchronized String getXLabel ()
boolean getXLog ()
synchronized double[] getXRange ()
synchronized Vector[] getXTicks ()
synchronized double[] getYAutoRange ()
String getYLabel ()
boolean getYLog ()
synchronized double[] getYRange ()
synchronized Vector[] getYTicks ()
void init ()
synchronized void paintComponent (Graphics graphics)
void parseFile (String filespec)
void parseFile (String filespec, URL documentBase)
synchronized int print (Graphics graphics, PageFormat format, int index) throws PrinterException
synchronized void read (String command)
synchronized void read (InputStream inputStream) throws IOException
String ReadPlotApplet ()
void redo ()
void removeEditListener (EditListener listener)
synchronized void removeLegend (int dataset)
synchronized void renameLegend (int dataset, String newName)
synchronized void resetAxes ()
synchronized void samplePlot ()
synchronized void setBackground (Color background)
synchronized void setBars (double width, double offset)
void setBars (boolean on)
synchronized void setBounds (int x, int y, int width, int height)
synchronized void setButtons (boolean visible)
synchronized void setColor (boolean useColor)
synchronized void setColors (Color[] colors)
synchronized void setConnected (boolean on, int dataset)
void setConnected (boolean on)
void setDataurl (String filespec)
void setDocumentBase (URL documentBase)
void setEditable (int dataset)
synchronized void setForeground (Color foreground)
synchronized void setGrid (boolean grid)
synchronized void setImpulses (boolean on, int dataset)
synchronized void setImpulses (boolean on)
synchronized void setLabelFont (String name)
synchronized void setMarksStyle (String style, int dataset)
synchronized void setMarksStyle (String style)
void setNumSets (int numSets)
synchronized void setPlotRectangle (Rectangle rectangle)
void setPointsPersistence (int persistence)
void setReuseDatasets (boolean on)
synchronized void setSize (int width, int height)
synchronized void setTitle (String title)
synchronized void setTitleFont (String name)
synchronized void setWrap (boolean wrap)
synchronized void setXLabel (String label)
synchronized void setXLog (boolean xlog)
void setXPersistence (double persistence)
synchronized void setXRange (double min, double max)
synchronized void setYLabel (String label)
synchronized void setYLog (boolean ylog)
synchronized void setYRange (double min, double max)
void undo ()
synchronized void write (Writer out, String dtd)
synchronized void write (OutputStream out, String dtd)
void write (OutputStream out)
synchronized void writeData (PrintWriter output)
synchronized void writeFormat (PrintWriter output)
synchronized void writeOldSyntax (OutputStream out)
synchronized void zoom (double lowx, double lowy, double highx, double highy)

Static Public Member Functions

static Color getColorByName (String name)

Public Attributes

URL _documentBase = null

Static Public Attributes

static final String PTPLOT_RELEASE = "5.7"

Protected Member Functions

synchronized void _checkDatasetIndex (int dataset)
void _drawBar (Graphics graphics, int dataset, long xpos, long ypos, boolean clip)
void _drawErrorBar (Graphics graphics, int dataset, long xpos, long yLowEBPos, long yHighEBPos, boolean clip)
void _drawImpulse (Graphics graphics, long xpos, long ypos, boolean clip)
void _drawLine (Graphics graphics, int dataset, long startx, long starty, long endx, long endy, boolean clip, float width)
void _drawLine (Graphics graphics, int dataset, long startx, long starty, long endx, long endy, boolean clip)
synchronized void _drawPlot (Graphics graphics, boolean clearfirst)
synchronized void _drawPlot (Graphics graphics, boolean clearfirst, Rectangle drawRectangle)
void _drawPoint (Graphics graphics, int dataset, long xpos, long ypos, boolean clip)
void _help ()
boolean _parseLine (String line)
void _setButtonsVisibility (boolean vis)
void _setPadding (double padding)
void _setWidth (Graphics graphics, float width)
void _writeOldSyntax (PrintWriter output)

Protected Attributes

Color _background = Color.white
int _bottomPadding = 5
int _currentdataset = -1
Color _foreground = Color.black
boolean _grid = true
int _height = 300
int _leftPadding = 10
int _lrx = 100
int _lry = 100
int _marks
double _padding = 0.05
transient BufferedImage _plotImage = null
Vector _points = new Vector()
int _preferredHeight = 300
int _preferredWidth = 500
transient boolean _rangesGivenByZooming = false
int _rightPadding = 10
Rectangle _specifiedPlotRectangle = null
int _topPadding = 10
int _ulx = 1
int _uly = 1
boolean _usecolor = true
int _width = 500
boolean _wrap = false
double _wrapHigh
double _wrapLow
double _xBottom = Double.MAX_VALUE
double _xhighgiven
boolean _xlog = false
double _xlowgiven
transient double _xMax = 0
transient double _xMin = 0
transient boolean _xRangeGiven = false
double _xscale = 1.0
double _xTop = -Double.MAX_VALUE
double _yBottom = Double.MAX_VALUE
double _yhighgiven
boolean _ylog = false
double _ylowgiven
transient double _yMax = 0
transient double _yMin = 0
transient boolean _yRangeGiven = false
double _yscale = 1.0
double _yTop = -Double.MAX_VALUE

Static Protected Attributes

static Color[] _colors
static final double _LOG10SCALE = 1 / Math.log(10)

Package Functions

void _zoom (int x, int y)
void _zoomBox (int x, int y)
void _zoomStart (int x, int y)

Package Attributes

double _originalXhigh = 0.0
double _originalXlow = 0.0
boolean _originalXRangeGiven = false
double _originalYhigh = 0.0
double _originalYlow = 0.0
boolean _originalYRangeGiven = false

Private Member Functions

synchronized void _edit (int x, int y)
synchronized void _editPoint (int x, int y)
synchronized void _editStart (int x, int y)
void _notifyListeners (int dataset)
void _setData (int dataset, double[][] data)

Private Attributes

int _currentEditX
int _currentEditY
int _dataset = 0
Vector _editListeners = null
boolean[] _editSpecSet
int[] _editSpecX
int[] _editSpecY
Stack _redoStack = new Stack()
Stack _undoStack = new Stack()

Static Private Attributes

static final Color _editColor = Color.white


class  EditMouseListener
class  ModifyListener
class  UndoListener

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index