|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
cz.cuni.pogamut.server.MapVisualizationPanel
public class MapVisualizationPanel
Component for visualization of the map for UT2004. It needs UTWorld instance for getting the information and after that it is handled autonomously ... It will draw only bots that are connected through the UTWorld instance.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
private UTServerConnection |
connection
|
private GameInfo |
gameInfo
|
private UTServerInfoSnapshot |
info
|
private boolean |
initialized
|
private java.util.logging.Logger |
log
|
private double[] |
mapExtens
Contains minX, minY, maxX, maxY of the navpoints coords. |
private boolean |
mapsExtensCounted
Flag whether mapExtens have been counted. |
private static int |
MAX_X
|
private static int |
MAX_Y
|
private static int |
MAX_Z
|
private static int |
MIN_X
|
private static int |
MIN_Y
|
private static int |
MIN_Z
|
private java.util.List<NavPoint> |
navPoints
|
private java.util.Map<java.lang.String,NavPoint> |
navPointsMap
|
private java.util.Map<java.lang.String,Player> |
players
|
private java.util.logging.Logger |
rawGBLog
|
private Flag<UTServerState> |
serverState
|
private boolean |
serverUp
Flag whether server is up. |
private java.net.URI |
serverURI
|
private UTWorld |
ut
|
private java.util.concurrent.CountDownLatch |
waitNavPoints
|
private int |
xBorder
Border for drawing. |
private double |
xLength
mapExtens[MAX_X] - mapExtens[MIN_X] |
private double |
xScale
Scale x-double from UT2004 to pixel on the map. |
private int |
xSize
X-size of the map on the panel int pixels. |
private int |
yBorder
Border for drawing. |
private double |
yLength
mapExtens[MAX_Y] - mapExtens[MIN_Y] |
private double |
yScale
Scale y-double from UT2004 to pixel on the map. |
private int |
ySize
Y-size of the map on the panel int pixels. |
private double |
zLength
mapExtens[MAX_Z] - mapExtens[MIN_Z] |
private double |
zScale
Scale y-double from UT2004 to pixel on the map. |
private int |
zSize
Y-size of the map on the panel int pixels. |
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 | |
---|---|
MapVisualizationPanel(java.net.URI serverURI)
|
Method Summary | |
---|---|
private void |
addPlayer(PlayerJoinsGame p)
|
private void |
clearMapInfo()
|
private void |
countMapExtens(java.util.List<NavPoint> navPoints)
|
void |
flagChanged(UTServerState changedValue,
int listenerParam)
When registering the flag you may additionally specify listener parameter, if you do so - your listener will be called with that parameter. |
int |
getAutoReconnectMillis()
|
MessageType |
getExpectedWelcomeMessage()
Which message we should expect as the greeting from GameBots? |
java.net.URI |
getGamebotsControlConnectionURI()
|
GameInfo |
getGameInfo()
|
UTServerInfoSnapshot |
getInfo()
Must NOT return null !!! |
java.util.logging.Logger |
getLog()
|
java.util.List<NavPoint> |
getNavPointsBlocking()
|
private int[] |
getPoint(double[] xyz)
Input is the point from the real data from the server, then it is scaled down to the xSize,ySize of the map in pixels according xLength and yLength |
int |
getPongTimeoutMillis()
|
java.util.logging.Logger |
getRawGBLog()
Which log should be used to dump raw GB data. |
UTServerState |
getServerState()
|
Flag<UTServerState> |
getServerStateFlag()
|
java.util.concurrent.CountDownLatch |
getWaitInventoryLatch()
|
java.util.concurrent.CountDownLatch |
getWaitItemsLatch()
|
java.util.concurrent.CountDownLatch |
getWaitMapsLatch()
|
java.util.concurrent.CountDownLatch |
getWaitNavPointsLatch()
|
java.util.concurrent.CountDownLatch |
getWaitRefreshInfoLatch()
|
private double[] |
getXYZ_UT(Triple location)
|
private void |
init()
Method called for the initialization of the map. |
boolean |
isAutomaticallyReconnect()
Whether we should automaticly try to reconnect. |
boolean |
isPingPong()
Whether we should check whether the connection is active. |
static void |
main(java.lang.String[] args)
|
protected void |
paintComponent(java.awt.Graphics g)
|
private void |
paintDebug(java.awt.Graphics g)
|
private void |
paintNavPoints(java.awt.Graphics g)
|
private void |
paintPlayer(java.awt.Graphics g,
Player pl)
|
private void |
paintPlayers(java.awt.Graphics g)
|
private void |
paintServerDown(java.awt.Graphics g)
|
private void |
paintServerUp(java.awt.Graphics g)
|
private void |
processNavPoints(java.util.List<NavPoint> navPoints)
|
void |
receiveMessage(RcvMsgEvent e)
|
private void |
recountScales()
|
private void |
removePlayer(PlayerLeft p)
|
private void |
requestNavPoints()
|
void |
setGameInfo(GameInfo info)
|
void |
setMapSize(int x,
int y)
|
void |
terminate()
Will stop the communication with the server. |
void |
tryToRefresh()
|
private void |
updatePlayer(Player p)
|
boolean |
waitForNFOMessageInHandshake()
Whether we should wait for NFO message after READY is sent. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printComponent, printChildren, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, checkImage, checkImage, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final int MIN_X
private static final int MAX_X
private static final int MIN_Y
private static final int MAX_Y
private static final int MIN_Z
private static final int MAX_Z
private UTWorld ut
private java.util.logging.Logger log
private java.util.logging.Logger rawGBLog
private boolean initialized
private java.net.URI serverURI
private UTServerConnection connection
private UTServerInfoSnapshot info
private GameInfo gameInfo
private Flag<UTServerState> serverState
private java.util.Map<java.lang.String,Player> players
private java.util.List<NavPoint> navPoints
private java.util.Map<java.lang.String,NavPoint> navPointsMap
private java.util.concurrent.CountDownLatch waitNavPoints
private double[] mapExtens
private double xLength
private double yLength
private double zLength
private double xScale
private double yScale
private double zScale
private int xSize
private int ySize
private int zSize
private int xBorder
private int yBorder
private boolean mapsExtensCounted
private boolean serverUp
Constructor Detail |
---|
public MapVisualizationPanel(java.net.URI serverURI)
Method Detail |
---|
private void init()
private void processNavPoints(java.util.List<NavPoint> navPoints)
private void requestNavPoints()
public void terminate()
public int getAutoReconnectMillis()
getAutoReconnectMillis
in interface UTServerConnectionInterface
public boolean waitForNFOMessageInHandshake()
UTServerConnectionInterface
waitForNFOMessageInHandshake
in interface UTServerConnectionInterface
public MessageType getExpectedWelcomeMessage()
UTServerConnectionInterface
getExpectedWelcomeMessage
in interface UTServerConnectionInterface
public GameInfo getGameInfo()
getGameInfo
in interface UTServerConnectionInterface
public UTServerInfoSnapshot getInfo()
UTServerConnectionInterface
getInfo
in interface UTServerConnectionInterface
public java.util.logging.Logger getLog()
getLog
in interface UTServerConnectionInterface
public int getPongTimeoutMillis()
getPongTimeoutMillis
in interface UTServerConnectionInterface
public java.util.logging.Logger getRawGBLog()
UTServerConnectionInterface
getRawGBLog
in interface UTServerConnectionInterface
public UTServerState getServerState()
getServerState
in interface UTServerConnectionInterface
public Flag<UTServerState> getServerStateFlag()
getServerStateFlag
in interface UTServerConnectionInterface
public java.net.URI getGamebotsControlConnectionURI()
getGamebotsControlConnectionURI
in interface UTServerConnectionInterface
public java.util.concurrent.CountDownLatch getWaitInventoryLatch()
getWaitInventoryLatch
in interface UTServerConnectionInterface
public java.util.concurrent.CountDownLatch getWaitItemsLatch()
getWaitItemsLatch
in interface UTServerConnectionInterface
public java.util.concurrent.CountDownLatch getWaitMapsLatch()
getWaitMapsLatch
in interface UTServerConnectionInterface
public java.util.concurrent.CountDownLatch getWaitNavPointsLatch()
getWaitNavPointsLatch
in interface UTServerConnectionInterface
public java.util.concurrent.CountDownLatch getWaitRefreshInfoLatch()
getWaitRefreshInfoLatch
in interface UTServerConnectionInterface
public boolean isAutomaticallyReconnect()
UTServerConnectionInterface
isAutomaticallyReconnect
in interface UTServerConnectionInterface
public boolean isPingPong()
UTServerConnectionInterface
isPingPong
in interface UTServerConnectionInterface
public void setGameInfo(GameInfo info)
setGameInfo
in interface UTServerConnectionInterface
public java.util.List<NavPoint> getNavPointsBlocking()
public void tryToRefresh()
public void receiveMessage(RcvMsgEvent e)
receiveMessage
in interface RcvMsgListener
private void addPlayer(PlayerJoinsGame p)
private void removePlayer(PlayerLeft p)
private void updatePlayer(Player p)
private void countMapExtens(java.util.List<NavPoint> navPoints)
private void recountScales()
public void setMapSize(int x, int y)
private double[] getXYZ_UT(Triple location)
private int[] getPoint(double[] xyz)
xyz
- ... double[3] ... xyz, xyz[0] == x, xyz[1] == y, xyz[2] == z
private void paintNavPoints(java.awt.Graphics g)
private void paintPlayer(java.awt.Graphics g, Player pl)
private void paintPlayers(java.awt.Graphics g)
private void paintDebug(java.awt.Graphics g)
private void paintServerUp(java.awt.Graphics g)
private void paintServerDown(java.awt.Graphics g)
protected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
private void clearMapInfo()
public void flagChanged(UTServerState changedValue, int listenerParam)
FlagListener
flagChanged
in interface FlagListener<UTServerState>
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |