Class TransitMap

java.lang.Object
  |
  +--TransitMap
All Implemented Interfaces:
uwcse.graphics.GWindowEventHandler

public class TransitMap
extends java.lang.Object
implements uwcse.graphics.GWindowEventHandler

This class creates and updates a display of bus locations.


Constructor Summary
TransitMap(java.lang.String img, double latA, double lonA, double latB, double lonB)
          Create a new TransitMap using the given image.
 
Method Summary
 void keyPressed(uwcse.graphics.GWindowEvent e)
          Process notification of KeyPressed events
 void keyReleased(uwcse.graphics.GWindowEvent e)
          Process notification of KeyReleased events
 void mouseDragged(uwcse.graphics.GWindowEvent e)
          Process notification of MouseDragged events
 void mousePressed(uwcse.graphics.GWindowEvent e)
          Process notification of MousePressed events
 void mouseReleased(uwcse.graphics.GWindowEvent e)
          Process notification of MouseReleased events
 int pixelX(double lon)
          Convert a longitude value to an X-pixel address
 int pixelY(double lat)
          Convert a latitude value to a Y-pixel address
 void processBusEvent(hw7.TransitBusEvent evt)
          Given a new bus event, check to see if we already have a symbol for it.
 void timerExpired(uwcse.graphics.GWindowEvent e)
          Process notification of TimerExpired events
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransitMap

public TransitMap(java.lang.String img,
                  double latA,
                  double lonA,
                  double latB,
                  double lonB)
Create a new TransitMap using the given image. First create the GWindow to show the map in, then create the map ImageShape and add it to the GWindow.

Parameters:
img - the name of the image file.
latA - latitude of top left corner in degrees (-South, +North)
lonA - longitude of top left corner in degrees (-West, +East)
latB - latitude of bottom right corner in degrees (-South, +North)
lonB - longitude of bottom right corner in degrees (-West, +East)
Method Detail

processBusEvent

public void processBusEvent(hw7.TransitBusEvent evt)
Given a new bus event, check to see if we already have a symbol for it. If we don't then create a new symbol. Move the symbol to the correct place on the map.


pixelX

public int pixelX(double lon)
Convert a longitude value to an X-pixel address

Parameters:
lon - the longitude to convert
Returns:
int the x-offset within the window that the longitude represents

pixelY

public int pixelY(double lat)
Convert a latitude value to a Y-pixel address

Parameters:
lat - the latitude to convert
Returns:
int the y-offset within the window that the latitude represents

mouseReleased

public void mouseReleased(uwcse.graphics.GWindowEvent e)
Process notification of MouseReleased events

Specified by:
mouseReleased in interface uwcse.graphics.GWindowEventHandler
Parameters:
e - the event object

mousePressed

public void mousePressed(uwcse.graphics.GWindowEvent e)
Process notification of MousePressed events

Specified by:
mousePressed in interface uwcse.graphics.GWindowEventHandler
Parameters:
e - the event object

mouseDragged

public void mouseDragged(uwcse.graphics.GWindowEvent e)
Process notification of MouseDragged events

Specified by:
mouseDragged in interface uwcse.graphics.GWindowEventHandler
Parameters:
e - the event object

timerExpired

public void timerExpired(uwcse.graphics.GWindowEvent e)
Process notification of TimerExpired events

Specified by:
timerExpired in interface uwcse.graphics.GWindowEventHandler
Parameters:
e - the event object

keyPressed

public void keyPressed(uwcse.graphics.GWindowEvent e)
Process notification of KeyPressed events

Specified by:
keyPressed in interface uwcse.graphics.GWindowEventHandler
Parameters:
e - the event object

keyReleased

public void keyReleased(uwcse.graphics.GWindowEvent e)
Process notification of KeyReleased events

Specified by:
keyReleased in interface uwcse.graphics.GWindowEventHandler
Parameters:
e - the event object