|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel aim4.gui.Canvas
public class Canvas
The Canvas is the visual area on which the Layout, IntersectionManagers, Vehicles, and so forth are drawn for the user to see.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static Color |
ASPHALT_COLOR
The color of the asphalt, if the image does not load properly. |
static Color |
BACKGROUND_COLOR
The color of the background |
static Color |
GRASS_COLOR
The color of the grass, if the image does not load properly. |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
Canvas(Viewer viewer)
Create a new canvas. |
Method Summary | |
---|---|
void |
cleanUp()
Clean up the canvas |
void |
componentHidden(ComponentEvent e)
|
void |
componentMoved(ComponentEvent e)
|
void |
componentResized(ComponentEvent e)
|
void |
componentShown(ComponentEvent e)
|
Point2D |
getMapPosition(int screenPosX,
int screenPosY)
Convert the position on screen to the position on the map. |
void |
highlightVehicle(int vin)
Highlight a particular vehicle. |
void |
initWithGivenMap(BasicMap basicMap)
Initialize the canvas with a given map. |
void |
mouseClicked(MouseEvent e)
|
void |
mouseDragged(MouseEvent e)
|
void |
mouseEntered(MouseEvent e)
|
void |
mouseExited(MouseEvent e)
|
void |
mouseMoved(MouseEvent e)
|
void |
mousePressed(MouseEvent e)
|
void |
mouseReleased(MouseEvent e)
|
void |
mouseWheelMoved(MouseWheelEvent e)
|
void |
paint(Graphics g)
|
void |
saveScreenShot(String outFileName)
Save the screen to a file in PNG format. |
void |
setIsShowIMDebugShapes(boolean useIMDebugShapes)
Set whether or not the canvas draws the IM shapes. |
void |
setIsShowSimulationTime(boolean b)
Set whether to show the simulation time. |
void |
setIsShowVin(boolean b)
Set whether to show the VIN numbers. |
void |
update()
Update the canvas to visualize the current state of simulation. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Color GRASS_COLOR
public static final Color ASPHALT_COLOR
public static final Color BACKGROUND_COLOR
Constructor Detail |
---|
public Canvas(Viewer viewer)
viewer
- the viewer objectMethod Detail |
---|
public void initWithGivenMap(BasicMap basicMap)
basicMap
- the layout the canvas will be visualizingpublic void cleanUp()
public void update()
public void paint(Graphics g)
paint
in class JComponent
public void componentHidden(ComponentEvent e)
componentHidden
in interface ComponentListener
public void componentMoved(ComponentEvent e)
componentMoved
in interface ComponentListener
public void componentResized(ComponentEvent e)
componentResized
in interface ComponentListener
public void componentShown(ComponentEvent e)
componentShown
in interface ComponentListener
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved
in interface MouseWheelListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void setIsShowSimulationTime(boolean b)
b
- whether to show the simulation timepublic void setIsShowVin(boolean b)
b
- whether to show the VIN numberspublic void setIsShowIMDebugShapes(boolean useIMDebugShapes)
useIMDebugShapes
- whether or not the canvas should draw the shapespublic void saveScreenShot(String outFileName)
outFileName
- the output file namepublic Point2D getMapPosition(int screenPosX, int screenPosY)
screenPosX
- The x-coordinate of the screen positionscreenPosY
- The y-coordinate of the screen position
public void highlightVehicle(int vin)
vin
- the VIN number of the vehicle
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |