anl.repast.gis.display
Class RepastOMLayer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.bbn.openmap.Layer
                  extended by com.bbn.openmap.layer.OMGraphicHandlerLayer
                      extended by anl.repast.gis.display.RepastOMLayer
All Implemented Interfaces:
com.bbn.openmap.event.ProjectionListener, com.bbn.openmap.omGraphics.event.GestureResponsePolicy, com.bbn.openmap.ProjectionPainter, com.bbn.openmap.PropertyConsumer, com.bbn.openmap.util.DataBoundsProvider, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.io.Serializable, java.util.EventListener

public class RepastOMLayer
extends com.bbn.openmap.layer.OMGraphicHandlerLayer
implements com.bbn.openmap.util.DataBoundsProvider

Author:
Robert Najlis
See Also:
Serialized Form

Nested Class Summary
 
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
cancelled, CANCELLED_LOCK, consumeEvents, ConsumeEventsProperty, filter, layerWorker, LAYERWORKER_LOCK, mouseEventInterpreter, mouseModeIDs, MouseModesProperty, projectionChangePolicy, ProjectionChangePolicyProperty, renderPolicy, RenderPolicyProperty, selectedList
 
Fields inherited from class com.bbn.openmap.Layer
addAsBackground, AddAsBackgroundProperty, addToBeanContext, AddToBeanContextProperty, autoPalette, AutoPaletteProperty, beanContextChildSupport, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, IDListeners, localHackList, lsListeners, palette, paletteListener, PrettyNameProperty, propertyPrefix, RedrawCmd, removeable, RemoveableProperty, SWING_PACKAGE, windowSupport
 
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 com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
RepastOMLayer(OpenMapDisplay omDisplay, java.lang.String title)
           
 
Method Summary
 void ActionPerformed(java.awt.event.ActionEvent evt)
           
 void deselect(com.bbn.openmap.omGraphics.OMGraphicList list)
          Designate a list of OMGraphics as deselected.
 OpenMapAgent findClosestAgent(int x, int y)
          find agent closet to x,y location
 OpenMapAgent findClosestAgent(int x, int y, float limit)
          find agent closet to x,y location within limit
 OpenMapAgent findClosestAgent(java.awt.Point p)
          find agent closet to Point
 OpenMapAgent findClosestAgent(java.awt.Point p, float limit)
          find agent closet to Point within limit
 OpenMapAgent getAgentFromOMGraphic(com.bbn.openmap.omGraphics.OMGraphic omg)
           
 java.util.List getAgentList()
           
 OpenMapAgent getAgentToMove()
           
 com.bbn.openmap.LatLonPoint getCenter(float[] extents)
           
 com.bbn.openmap.util.DataBounds getDataBounds()
           
 float[] getExtents(com.bbn.openmap.omGraphics.OMGraphic omg)
           
 java.awt.Paint getHighlightFillPaint()
           
 java.lang.String getInfoText(com.bbn.openmap.omGraphics.OMGraphic omg)
          If applicable, should return a short, informational string about the OMGraphic to be displayed in the InformationDelegator.
 java.util.List getItemsForMapMenu(com.bbn.openmap.event.MapMouseEvent mme)
          returns a list of JMenuItems when the user right clicks on the map in a location where there is no OMGraphic (no agent)
 java.util.List getItemsForOMGraphicMenu(com.bbn.openmap.omGraphics.OMGraphic omg)
          Return a java.util.List containing input for a JMenu with contents applicable to a popup menu for a location over an OMGraphic.
 com.bbn.openmap.LatLonPoint getMoveFromPoint(com.bbn.openmap.omGraphics.OMGraphic omg)
           
 java.lang.String getName()
           
 java.lang.String getTitle()
           
 java.lang.String getToolTipTextFor(com.bbn.openmap.omGraphics.OMGraphic omg)
          If applicable, should return a tool tip for the OMGraphic.
 void highlight(com.bbn.openmap.omGraphics.OMGraphic omg)
          Fleeting change of appearance for mouse movements over an OMGraphic.
 boolean isSelectable(com.bbn.openmap.omGraphics.OMGraphic omg)
          Query asking if an OMGraphic is selectable, or able to be moved, deleted or otherwise modified.
 boolean leftClick(com.bbn.openmap.event.MapMouseEvent evt)
           
static void main(java.lang.String[] args)
           
 boolean mouseOver(com.bbn.openmap.event.MapMouseEvent evt)
           
 void moveAgent(int x, int y)
           
 void moveAgent(com.bbn.openmap.LatLonPoint llp)
           
 void moveAgent(java.awt.Point p)
           
 com.bbn.openmap.omGraphics.OMGraphicList prepare()
          Sets up the layer to display the agents properly.
 boolean receivesMapEvents()
           
 void select(com.bbn.openmap.omGraphics.OMGraphicList list)
          Designate a list of OMGraphics as selected.
 void setAgentList(java.util.List omAgents)
          set the list of OpenMapAgents used by the layer
 void setAgentToMove(OpenMapAgent agent)
           
 void setHighlightFillPaint(java.awt.Paint highlightFillPaint)
           
 void setMoveFromPoint(com.bbn.openmap.LatLonPoint point)
           
 void setMoveToPoint(java.awt.Point p)
           
 void setTitle(java.lang.String title)
           
 void setWaitingToMove(boolean waiting)
           
 void undoMoveAgent()
           
 void unhighlight(com.bbn.openmap.omGraphics.OMGraphic omg)
          Notification to set OMGraphic to normal appearance.
 
Methods inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
canSetList, copy, cut, doAction, doPrepare, filter, filter, filter, getConsumeEvents, getFilter, getLayerWorker, getList, getMapMouseListener, getMouseEventInterpreter, getMouseModeIDsForEvents, getProjectionChangePolicy, getProperties, getPropertyInfo, getRenderPolicy, getSelected, interrupt, isCancelled, isHighlightable, isWorking, paint, paste, projectionChanged, renderDataForProjection, resetFiltering, setCancelled, setConsumeEvents, setFilter, setLayerWorker, setList, setMouseEventInterpreter, setMouseModeIDsForEvents, setProjectionChangePolicy, setProperties, setRenderPolicy, supportsSQL, workerComplete
 
Methods inherited from class com.bbn.openmap.Layer
actionPerformed, addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, createWindowSupport, finalize, findAndInit, findAndInit, findAndUndo, fireHideToolTip, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAddToBeanContext, getBeanContext, getGUI, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hidePalette, isRemoveable, notifyHideHack, removeComponentListener, removed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setBeanContext, setName, setPaletteVisible, setProjection, setProjection, setProperties, setPropertyPrefix, setRemoveable, setVisible, setWindowSupport, showPalette
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, 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, unregisterKeyboardAction, update, updateUI
 
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, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, 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, 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, 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, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.beans.beancontext.BeanContextChild
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

RepastOMLayer

public RepastOMLayer(OpenMapDisplay omDisplay,
                     java.lang.String title)
Method Detail

getTitle

public java.lang.String getTitle()

setTitle

public void setTitle(java.lang.String title)

setAgentList

public void setAgentList(java.util.List omAgents)
set the list of OpenMapAgents used by the layer

Parameters:
gisAgents -

getAgentFromOMGraphic

public OpenMapAgent getAgentFromOMGraphic(com.bbn.openmap.omGraphics.OMGraphic omg)
Parameters:
omg -
Returns:
OpenMapAgent

findClosestAgent

public OpenMapAgent findClosestAgent(int x,
                                     int y)
find agent closet to x,y location

Parameters:
x -
y -
Returns:
OpenMapAgent

findClosestAgent

public OpenMapAgent findClosestAgent(java.awt.Point p)
find agent closet to Point

Parameters:
p -
Returns:
OpenMapAgent

findClosestAgent

public OpenMapAgent findClosestAgent(java.awt.Point p,
                                     float limit)
find agent closet to Point within limit

Parameters:
p -
Returns:
OpenMapAgent

findClosestAgent

public OpenMapAgent findClosestAgent(int x,
                                     int y,
                                     float limit)
find agent closet to x,y location within limit

Parameters:
p -
Returns:
OpenMapAgent

prepare

public com.bbn.openmap.omGraphics.OMGraphicList prepare()
Sets up the layer to display the agents properly. In General, you should not call this method directly, instead, call doPrepare() From OpenMap OMGraphicHandlerLayer: This is the main method you should be concerned with when overriding this class. You have to make sure that this method returns an OMGraphicList that is ready to be rendered. That means they need to be generated with the current projection, which can be retrieved by calling getProjection().

This method will be called in a separate thread if doPrepare() is called on the layer. This will automatically cause repaint() to be called, which lets java know to call paint() on this class.

Note that the default action of this method is to get the OMGraphicList as it is currently set in the layer, reprojects the list with the current projection (calls generate() on them), and then returns the current list.

If your layer needs to change what is on the list based on what the current projection is, you can either clear() the list yourself and add new OMGraphics to it (remember to call generate(Projection) on them), and return the list. You also have the option of setting a ListResetPCPolicy, which will automatically set the list to null when the projection changes before calling this method. The OMGraphicHandlerList will ignore a null OMGraphicList.

NOTE: If you call prepare directly, you may need to call repaint(), too. With all invocations of this method that are cause by a projection change, repaint() will be called for you. The method is synchronized in case renderDataForProjection() gets called while in the middle of this method. For a different projection, that would be bad.

Overrides:
prepare in class com.bbn.openmap.layer.OMGraphicHandlerLayer

select

public void select(com.bbn.openmap.omGraphics.OMGraphicList list)
Designate a list of OMGraphics as selected.

Specified by:
select in interface com.bbn.openmap.omGraphics.event.GestureResponsePolicy
Overrides:
select in class com.bbn.openmap.layer.OMGraphicHandlerLayer

deselect

public void deselect(com.bbn.openmap.omGraphics.OMGraphicList list)
Designate a list of OMGraphics as deselected.

Specified by:
deselect in interface com.bbn.openmap.omGraphics.event.GestureResponsePolicy
Overrides:
deselect in class com.bbn.openmap.layer.OMGraphicHandlerLayer

highlight

public void highlight(com.bbn.openmap.omGraphics.OMGraphic omg)
Fleeting change of appearance for mouse movements over an OMGraphic.

Specified by:
highlight in interface com.bbn.openmap.omGraphics.event.GestureResponsePolicy
Overrides:
highlight in class com.bbn.openmap.layer.OMGraphicHandlerLayer

unhighlight

public void unhighlight(com.bbn.openmap.omGraphics.OMGraphic omg)
Notification to set OMGraphic to normal appearance.

Specified by:
unhighlight in interface com.bbn.openmap.omGraphics.event.GestureResponsePolicy
Overrides:
unhighlight in class com.bbn.openmap.layer.OMGraphicHandlerLayer

isSelectable

public boolean isSelectable(com.bbn.openmap.omGraphics.OMGraphic omg)
Query asking if an OMGraphic is selectable, or able to be moved, deleted or otherwise modified. Responding true to this method may cause select() to be called (depends on the MapMouseInterpertor) so the meaning depends on what the layer does in select.

Specified by:
isSelectable in interface com.bbn.openmap.omGraphics.event.GestureResponsePolicy
Overrides:
isSelectable in class com.bbn.openmap.layer.OMGraphicHandlerLayer

getToolTipTextFor

public java.lang.String getToolTipTextFor(com.bbn.openmap.omGraphics.OMGraphic omg)
If applicable, should return a tool tip for the OMGraphic. Return null if nothing should be shown.

Specified by:
getToolTipTextFor in interface com.bbn.openmap.omGraphics.event.GestureResponsePolicy
Overrides:
getToolTipTextFor in class com.bbn.openmap.layer.OMGraphicHandlerLayer

getInfoText

public java.lang.String getInfoText(com.bbn.openmap.omGraphics.OMGraphic omg)
If applicable, should return a short, informational string about the OMGraphic to be displayed in the InformationDelegator. Return null if nothing should be displayed.

Specified by:
getInfoText in interface com.bbn.openmap.omGraphics.event.GestureResponsePolicy
Overrides:
getInfoText in class com.bbn.openmap.layer.OMGraphicHandlerLayer

getItemsForOMGraphicMenu

public java.util.List getItemsForOMGraphicMenu(com.bbn.openmap.omGraphics.OMGraphic omg)
Return a java.util.List containing input for a JMenu with contents applicable to a popup menu for a location over an OMGraphic.

Specified by:
getItemsForOMGraphicMenu in interface com.bbn.openmap.omGraphics.event.GestureResponsePolicy
Overrides:
getItemsForOMGraphicMenu in class com.bbn.openmap.layer.OMGraphicHandlerLayer
Returns:
a List containing options for the given OMGraphic. Return null or empty list if there are no options.

getItemsForMapMenu

public java.util.List getItemsForMapMenu(com.bbn.openmap.event.MapMouseEvent mme)
returns a list of JMenuItems when the user right clicks on the map in a location where there is no OMGraphic (no agent)

Specified by:
getItemsForMapMenu in interface com.bbn.openmap.omGraphics.event.GestureResponsePolicy
Overrides:
getItemsForMapMenu in class com.bbn.openmap.layer.OMGraphicHandlerLayer

receivesMapEvents

public boolean receivesMapEvents()
Specified by:
receivesMapEvents in interface com.bbn.openmap.omGraphics.event.GestureResponsePolicy
Overrides:
receivesMapEvents in class com.bbn.openmap.layer.OMGraphicHandlerLayer

getCenter

public com.bbn.openmap.LatLonPoint getCenter(float[] extents)

getExtents

public float[] getExtents(com.bbn.openmap.omGraphics.OMGraphic omg)

setWaitingToMove

public void setWaitingToMove(boolean waiting)

setAgentToMove

public void setAgentToMove(OpenMapAgent agent)

getAgentToMove

public OpenMapAgent getAgentToMove()

setMoveFromPoint

public void setMoveFromPoint(com.bbn.openmap.LatLonPoint point)

getMoveFromPoint

public com.bbn.openmap.LatLonPoint getMoveFromPoint(com.bbn.openmap.omGraphics.OMGraphic omg)

main

public static void main(java.lang.String[] args)

undoMoveAgent

public void undoMoveAgent()

moveAgent

public void moveAgent(com.bbn.openmap.LatLonPoint llp)

moveAgent

public void moveAgent(java.awt.Point p)

moveAgent

public void moveAgent(int x,
                      int y)

setMoveToPoint

public void setMoveToPoint(java.awt.Point p)

leftClick

public boolean leftClick(com.bbn.openmap.event.MapMouseEvent evt)
Specified by:
leftClick in interface com.bbn.openmap.omGraphics.event.GestureResponsePolicy
Overrides:
leftClick in class com.bbn.openmap.layer.OMGraphicHandlerLayer

mouseOver

public boolean mouseOver(com.bbn.openmap.event.MapMouseEvent evt)
Specified by:
mouseOver in interface com.bbn.openmap.omGraphics.event.GestureResponsePolicy
Overrides:
mouseOver in class com.bbn.openmap.layer.OMGraphicHandlerLayer

getHighlightFillPaint

public java.awt.Paint getHighlightFillPaint()

setHighlightFillPaint

public void setHighlightFillPaint(java.awt.Paint highlightFillPaint)

getAgentList

public java.util.List getAgentList()

ActionPerformed

public void ActionPerformed(java.awt.event.ActionEvent evt)

getDataBounds

public com.bbn.openmap.util.DataBounds getDataBounds()
Specified by:
getDataBounds in interface com.bbn.openmap.util.DataBoundsProvider

getName

public java.lang.String getName()
Specified by:
getName in interface com.bbn.openmap.util.DataBoundsProvider
Overrides:
getName in class java.awt.Component