Generic Canvas descendant object for drawing lines. This object does not have any intelligence or memory. This object can have zero or more drawers who will be notified when the component refeshing is needed. This object will pass the Graphics object to the associated DrawingController objects. The notified controllers can then draw whatever they want on the passed Graphics object.
Field Summary | |
protected int |
EMPTY
A class constant for denoting an empty list. |
Constructor Summary | |
DrawingCanvas()
A default constructor that creates an instance of the PlottingCanvas class. |
Method Summary | |
void |
addOwner(galapagos.DrawingController owner)
A mutator method that adds another DrawingController that will draw its trajectory on this canvas. |
void |
clear()
Erases the current contents of the PlottingCanvas by painting the whole canvas with the background color. |
void |
drawPolygon(java.awt.Graphics g,
java.awt.Polygon polygon,
java.awt.Color color)
|
void |
init()
Initializes the necessary objects for double-buffering drawing. |
void |
paint(java.awt.Graphics g)
Painting of the canvas is done by drawing the whole contents using the double-buffering technique. |
void |
plot(java.awt.Graphics graphic,
java.awt.Color color,
double size,
galapagos.Position pt1,
galapagos.Position pt2)
Draws a line between two points pt1 and pt2 on the parameter graphic. |
void |
setGrid(boolean showGrid)
A mutator method that sets the flag for drawing the grid lines. |
void |
setOrigin(int x,
int y)
A mutator method that sets the origin point. |
void |
setUnit(double pixelsPerUnit)
A mutator method that sets the scaling factor. |
void |
update(java.awt.Graphics g)
|