|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Panel | +--java.applet.Applet | +--equip.city.Ana | +--equip.city.Dub
applet delivering content for WWW visitors (dub)
this class communicates with the EQUIP City proxy, sending position ($P), orientation ($C) and user ($U) messages, and expecting user positions ($V) and refresh messages ($R) in response (all optional), followed by stop message ($S)
converts pixels to metres (based on applet parameters) and sends position data consistent with ultrasonic positioning messages (alternative would be to transform pixel values server-side)
mouse behaviour is as follows: click moves visitor to clickloc and sets position; orientation is determined from previous mouseup to most recent mouseup; possible extensions are press-drag-release and keypress movement
CityProxy
,
City protocol, Serialized FormInner Class Summary | |
protected class |
Dub.Visitor
encapsulates data received about a visitor |
Inner classes inherited from class java.applet.Applet |
java.applet.Applet.AccessibleApplet |
Inner classes inherited from class java.awt.Panel |
java.awt.Panel.AccessibleAWTPanel |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
protected float |
a
accuracy of our position data |
protected java.awt.image.BufferedImage |
bi
offscreen drawing buffer |
protected java.awt.Graphics2D |
big
offscreen drawing context |
protected int |
dragX
previous mouse x coordinate for drag |
protected int |
dragY
previous mouse y coordinate for drag |
protected int |
head
room orientation |
protected int |
lastX
previous mouse x coordinate for orientation |
protected int |
lastY
previous mouse y coordinate for orientation |
protected java.awt.Image |
map
background image for display |
protected java.text.MessageFormat |
mfc
format for sending orientation to proxy |
protected java.text.MessageFormat |
mfp
format for sending position to proxy |
protected java.text.MessageFormat |
mfv
format for position received from proxy |
protected int |
mouseX
mouse x coordinate |
protected int |
mouseY
mouse y coordinate |
protected int |
offsetX
positioning reference offset from graphics origin (pixels) |
protected int |
offsetY
positioning reference offset from graphics origin (pixels) |
protected float |
scale
pixels per meter (parameter is 10x for netscape bug) |
protected int |
sentH
last orientation sent to equip |
protected int |
sentX
previous mouse x coordinate sent to equip (minimising sending) |
protected int |
sentY
previous mouse y coordinate sent to equip (minimising sending) |
protected java.util.Vector |
visitors
visitor data received from proxy for display |
protected float |
z
(fixed) height value |
Fields inherited from class equip.city.Ana |
contentFrame, DEBUG, device, equip, host, in, initTime, listFrame, mfu, name, out, port, socket, updater |
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 | |
Dub()
|
Method Summary | |
void |
init()
initialises proxy connection, double buffer, listeners and formatters |
void |
mouseClicked(java.awt.event.MouseEvent e)
stores mouse position and updates display |
void |
mouseDragged(java.awt.event.MouseEvent e)
does nothing |
void |
mouseEntered(java.awt.event.MouseEvent e)
does nothing |
void |
mouseExited(java.awt.event.MouseEvent e)
does nothing |
void |
mouseMoved(java.awt.event.MouseEvent e)
does nothing |
void |
mousePressed(java.awt.event.MouseEvent e)
does nothing |
void |
mouseReleased(java.awt.event.MouseEvent e)
does nothing |
void |
paint(java.awt.Graphics g)
|
void |
paintVisitor(int h,
int x,
int y,
java.awt.Color c,
java.awt.Graphics2D g2d)
paints a visitor at (x,y) with orientation h (using AffineTransform) and color c |
void |
run()
sends messages, (optionally) receives visitors and refresh from proxy then sleeps for 1000ms |
void |
update(java.awt.Graphics g)
draws map and visitors to buffer and then to screen (Graphics2D) |
void |
updatePosition(java.awt.event.MouseEvent e)
responds to mouse event by updating position and orientation variables and display |
Methods inherited from class equip.city.Ana |
destroy, elapsedTime, handleRefresh, sendUser, start, stop |
Methods inherited from class java.applet.Applet |
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus |
Methods inherited from class java.awt.Panel |
addNotify |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.awt.Image map
values (MAP):
protected java.awt.image.BufferedImage bi
protected java.awt.Graphics2D big
protected float scale
values (SCALE):
protected int mouseX
initial values (XINITIAL):
protected int mouseY
initial values (YINITIAL):
protected int offsetX
values (XOFFSET):
protected int offsetY
values (YOFFSET):
protected int sentX
protected int sentY
protected int lastX
protected int lastY
protected int dragX
protected int dragY
protected float z
protected int head
values (HEADING):
protected int sentH
protected float a
protected java.text.MessageFormat mfp
protected java.text.MessageFormat mfv
protected java.text.MessageFormat mfc
protected java.util.Vector visitors
Constructor Detail |
public Dub()
Method Detail |
public void init()
init
in class Ana
public void updatePosition(java.awt.event.MouseEvent e)
e
- mouse event providing x and y for updatepublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void run()
run
in class Ana
public void paintVisitor(int h, int x, int y, java.awt.Color c, java.awt.Graphics2D g2d)
h
- visitor orientation (cartesian)x
- visitor x coordinatey
- visitor y coordinatec
- visitor colorg2d
- drawing contextpublic void update(java.awt.Graphics g)
update
in class java.awt.Container
g
- graphics context for drawingpublic void paint(java.awt.Graphics g)
paint
in class java.awt.Container
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |