nl.tudelft.goal.ut2004.visualizer.map
Class PureMapGLPanel

Package class diagram package PureMapGLPanel
java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by javax.media.opengl.awt.GLJPanel
                      extended by nl.tudelft.goal.ut2004.visualizer.map.MapGLPanel
                          extended by nl.tudelft.goal.ut2004.visualizer.map.SelectableMapGLPanel
                              extended by nl.tudelft.goal.ut2004.visualizer.map.PureMapGLPanel
All Implemented Interfaces:
cz.cuni.amis.utils.collections.CollectionEventListener<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer>, MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, javax.media.nativewindow.WindowClosingProtocol, javax.media.opengl.awt.AWTGLAutoDrawable, javax.media.opengl.awt.ComponentEvents, javax.media.opengl.GLAutoDrawable, javax.media.opengl.GLDrawable, MapViewpoint.ViewpointListener

public class PureMapGLPanel
extends SelectableMapGLPanel
implements cz.cuni.amis.utils.collections.CollectionEventListener<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer>

Simple map that overviews what is happening in the level right now. It listens for changes in server.getAgents() and server.getNativeBots() for adding and removing bots from map. This is intended for one map only, it is not intended to handle change from one map to another, simply discard this, call destroy() and create a new one. This is panel that shows one particular map. After you are finished with using the class, please call destroy() to remove listeners, stops redrawing and do some other clean up.

Author:
Honza
See Also:
Serialized Form

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
 
Nested classes/interfaces inherited from interface javax.media.nativewindow.WindowClosingProtocol
javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode
 
Field Summary
protected  MapColorGenerator colorGenerator
           
protected  cz.cuni.amis.pogamut.unreal.server.IUnrealServer server
          Server on which we listen for changes in agents and bots
 
Fields inherited from class nl.tudelft.goal.ut2004.visualizer.map.MapGLPanel
agentRenderes, environmentRenderer, lastGLName, logger, mapController, mapRenderer, mapViewpoint, objectRenderes
 
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 javax.media.opengl.GLAutoDrawable
SCREEN_CHANGE_ACTION_ENABLED
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
protected PureMapGLPanel(cz.cuni.amis.pogamut.unreal.communication.worldview.map.IUnrealMap map, cz.cuni.amis.pogamut.unreal.server.IUnrealServer server)
           
 
Method Summary
 void destroy()
          Remove listeners and basically clean up this map.
 void postAddEvent(Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> alreadyAdded, Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> whereWereAdded)
          Add renderers representing the agents to the map.
 void postRemoveEvent(Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> alreadyAdded, Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> whereWereRemoved)
          Do nothing
 void preAddEvent(Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> toBeAdded, Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> whereToAdd)
          Do nothing.
 void preRemoveEvent(Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> toBeRemoved, Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> whereToRemove)
          Remove renderers that represented the removed agents from the map
 void startDisplayLoop()
          Start display loop
 void stopDisplayLoop()
          Stop display loop
 
Methods inherited from class nl.tudelft.goal.ut2004.visualizer.map.SelectableMapGLPanel
getSelectionHandler, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, setSelectionHandler
 
Methods inherited from class nl.tudelft.goal.ut2004.visualizer.map.MapGLPanel
getMap, getObjectsAt, onChangedViewpoint
 
Methods inherited from class javax.media.opengl.awt.GLJPanel
addGLEventListener, addGLEventListener, addNotify, createContext, display, dispose, getAnimator, getAutoSwapBufferMode, getChosenGLCapabilities, getContext, getContextCreationFlags, getDefaultCloseOperation, getFactory, getGL, getGLProfile, getHandle, getNativeSurface, getThreadName, getUpstreamWidget, invoke, isRealized, paintComponent, removeGLEventListener, removeGLEventListener, removeNotify, reshape, setAnimator, setAutoSwapBufferMode, setContext, setContextCreationFlags, setDefaultCloseOperation, setGL, setOpaque, setRealized, shouldPreserveColorBufferIfTranslucent, swapBuffers, toString
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, 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, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, 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, checkImage, checkImage, 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, 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, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.media.opengl.awt.AWTGLAutoDrawable
repaint, setSize
 
Methods inherited from interface javax.media.opengl.GLDrawable
getHeight, getWidth
 
Methods inherited from interface javax.media.opengl.awt.ComponentEvents
addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener
 

Field Detail

server

protected cz.cuni.amis.pogamut.unreal.server.IUnrealServer server
Server on which we listen for changes in agents and bots


colorGenerator

protected MapColorGenerator colorGenerator
Constructor Detail

PureMapGLPanel

protected PureMapGLPanel(cz.cuni.amis.pogamut.unreal.communication.worldview.map.IUnrealMap map,
                         cz.cuni.amis.pogamut.unreal.server.IUnrealServer server)
Method Detail

startDisplayLoop

public void startDisplayLoop()
Start display loop


stopDisplayLoop

public void stopDisplayLoop()
Stop display loop


preAddEvent

public void preAddEvent(Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> toBeAdded,
                        Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> whereToAdd)
Do nothing.

Specified by:
preAddEvent in interface cz.cuni.amis.utils.collections.CollectionEventListener<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer>
Parameters:
toBeAdded -
whereToAdd -

postAddEvent

public void postAddEvent(Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> alreadyAdded,
                         Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> whereWereAdded)
Add renderers representing the agents to the map.

Specified by:
postAddEvent in interface cz.cuni.amis.utils.collections.CollectionEventListener<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer>
Parameters:
alreadyAdded -
whereWereAdded -

preRemoveEvent

public void preRemoveEvent(Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> toBeRemoved,
                           Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> whereToRemove)
Remove renderers that represented the removed agents from the map

Specified by:
preRemoveEvent in interface cz.cuni.amis.utils.collections.CollectionEventListener<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer>
Parameters:
toBeRemoved -
whereToRemove -

postRemoveEvent

public void postRemoveEvent(Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> alreadyAdded,
                            Collection<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer> whereWereRemoved)
Do nothing

Specified by:
postRemoveEvent in interface cz.cuni.amis.utils.collections.CollectionEventListener<cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer>
Parameters:
alreadyAdded -
whereWereRemoved -

destroy

public void destroy()
Description copied from class: MapGLPanel
Remove listeners and basically clean up this map. Any call to this object after this method should invoke exception (it doesn't but I can always hope in NullPointerException).

Specified by:
destroy in interface javax.media.opengl.GLAutoDrawable
Overrides:
destroy in class SelectableMapGLPanel


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.