The Graphics objects for the MVT
The Plot2DPanel is the primary plotting surface (a
JPanel) for the MVT. In it's simplest form, it is a
cartesian coordinate system with a set of axes. It will perform the
cartesian to screen coordinates automatically.
- public void addGraphicsObject(GraphicsComponent) is
how plotting on the surface is
done. Instead of drawing directly on the panel, some object is made
(a line, an arrow, a vector field, ...) and added to the panel. See
below for more information.
- public GraphicsList getGraphicsList() returns all of
the objects on the Plot2DPanel as a
- public void clearGraphicsList() is how the plotting
surface is wiped clean.
- public void setXYBounds(double, double, double, double)
sets the plotting bounds. See oneToOne() and
defaultY() for more information.
- public void defaultY() will automatically set the
y bounds to fit all of the objects on the plot panel.
- public void oneToOne() will automatically scale the
axes to make the aspect ratio 1-1.
Plotting on the panel. Understanding the
As stated above, to plot on a plotting panel, objects are added to
the Plot2DPanel. The superclass of all these is the abstract
class GraphicsComponent. The member variables are coordinates
(both screen and cartesian coordianates). The only method that needs
to be overrided is public void paintComponent(Graphics g).
As an object is created, this method will determine what it looks like.
Subclasses of GraphicsComponents
- Line: this object is a sequence of line segments.
This is often what is used for standard plots and ODE
- Arrow: the basic object of a vector field.
- VectorField: A series of Arrows used for
vector and direction fields
- Cross: a "plus" sign.
- TextObject: used to put text on the plot panel.
- Axes: the axes that appear on the plot panel.
Each of these classes has their own unique constructor and methods
to set data associated with each object. See the javadoc for more