anl.repast.gis.display
Class OpenMapDisplay

java.lang.Object
  extended by anl.repast.gis.display.OpenMapDisplay
All Implemented Interfaces:
MediaProducer

public class OpenMapDisplay
extends java.lang.Object
implements MediaProducer

Author:
Robert Najlis

Field Summary
 
Fields inherited from interface uchicago.src.sim.gui.MediaProducer
MPEG, QUICK_TIME
 
Constructor Summary
OpenMapDisplay()
          Constructor for OpenMapDisplay, no title
OpenMapDisplay(java.lang.String title)
          Constructor for OpenMapDisplay, set title for OpenMap frame default background color
OpenMapDisplay(java.lang.String title, java.awt.Color backgroundColor)
          Constructor for OpenMapDisplay, set title for OpenMap frame, set background color
OpenMapDisplay(java.lang.String title, java.awt.Color backgroundColor, boolean usePropertyFile)
          Constructor for OpenMapDisplay, set title for OpenMap frame, set background color, can also set true if you want to use the openmap.properties file.
 
Method Summary
 void addGraticuleLayer()
          add the Graticule layer to the map (shows lat/lon lines over the map)
 RepastOMLayer addLayer(java.util.List gisAgents, java.lang.String title)
          add a Layer of OpenMapAgents to the map display
 RepastOMLayer addLayer(java.util.List gisAgents, java.lang.String title, java.awt.Color highlightColor)
          add a Layer of OpenMapAgents to the map display set the highlight color for use when the mouse moves over a an agent on the map
 void addMovieFrame()
          Adds the currently displayed image as frame to a movie. setMovieName must be called before this method is called.
 RepastOMMultiLayer addMultiLayer(java.util.List gisAgents, java.lang.String title)
          add a Layer of MultiLayerOpenMapAgents to the map display
 RepastOMMultiLayer addMultiLayer(java.util.List gisAgents, java.lang.String title, java.awt.Color highlightColor)
          add a Layer of MultiLayerOpenMapAgent to the map display set the highlight color for use when the mouse moves over a an agent on the map
 com.bbn.openmap.layer.shape.ShapeLayer addShapeLayer(java.lang.String datasource, java.lang.String title)
          adds a shapelayer using default settings

this is just for display of the shapefile, it does not set any agent attributes

 com.bbn.openmap.layer.shape.ShapeLayer addShapeLayer(java.lang.String datasource, java.lang.String title, java.lang.String lineColor, java.lang.String fillColor)
          adds a shapelayer.
 com.bbn.openmap.dataAccess.shape.EsriGraphicList buildEsriGraphicList(java.util.Collection gisAgents)
          Takes a Collection of GisAgents, gets the OMGraphic from each, and attempts to build an EsriGraphicList from them.
 void centerMap(com.bbn.openmap.LatLonPoint center)
          center the map over a given LatLonPoint
 void closeMovie()
          Closes the movie, writing any remaining frames to the file.
 void dispose()
          dispose of the OpenMap frame
 java.util.ArrayList findClosestAgents(int x, int y)
           
 java.util.ArrayList findClosestAgents(int x, int y, float limit)
          given an x,y location returns list of closet agents from each layer
 com.bbn.openmap.gui.OpenMapFrame getFrame()
           
 java.awt.Color getHighlightColor()
           
 com.bbn.openmap.Layer getLayer(java.lang.String layerName)
          return the specified layer
 com.bbn.openmap.LayerHandler getLayerHandler()
           
 com.bbn.openmap.Layer[] getLayers()
           
 com.bbn.openmap.MapBean getMapBean()
           
 com.bbn.openmap.MapHandler getMapHandler()
           
 com.bbn.openmap.gui.BasicMapPanel getMapPanel()
           
 SimModel getModel()
          Gets the SimModel, if any, associated with this OpenMapDisplay.
 com.bbn.openmap.app.OpenMap getOpenMap()
           
 com.bbn.openmap.proj.Projection getProjection()
          get the current OpenMapProjection
 com.bbn.openmap.proj.Projection getProjection(com.bbn.openmap.Layer layer)
          get the current projection for the specified layer
 com.bbn.openmap.proj.Projection getProjection(java.lang.String layerName)
          get the current projection for the specified layer
 com.bbn.openmap.PropertyHandler getPropertyHandler()
           
 java.awt.Point latLonToPoint(com.bbn.openmap.LatLonPoint llp)
          convert an OpenMap LatLonPoint to a point object this is really a conversion from the LatLonPoint on a map to the x,y location used to display that LatLonPoint on the display
 com.bbn.openmap.LatLonPoint pointToLatLon(java.awt.Point p)
          convert a Point object to a LatLonPoint this is really a conversion from the x,y location used to display a point on the display to the that LatLonPoint on the display
 void setFrame(com.bbn.openmap.gui.OpenMapFrame frame)
           
 void setHighlightColor(java.awt.Color highlightColor)
           
 void setLayerHandler(com.bbn.openmap.LayerHandler layerHandler)
           
 void setLayers(com.bbn.openmap.Layer[] layers)
           
 void setMapBean(com.bbn.openmap.MapBean mapBean)
           
 void setMapHandler(com.bbn.openmap.MapHandler mapHandler)
           
 void setMapPanel(com.bbn.openmap.gui.BasicMapPanel mapPanel)
           
 void setMapScale(float scale)
          set the scale of the map display
 void setModel(SimModel model)
          Sets the SimModel to associate with this OpenMapDisplay.
 void setMovieName(java.lang.String fileName, java.lang.String movieType)
          Sets the name and type of a movie.
 void setOpenMap(com.bbn.openmap.app.OpenMap openMap)
           
 void setPropertyHandler(com.bbn.openmap.PropertyHandler propertyHandler)
           
 void setSnapshotFileName(java.lang.String fileName)
           
 void takeSnapshot()
           
 void updateDisplay()
          update all layers in the OpenMapDisplay
 boolean updateLayer(java.util.List gisAgents, java.lang.String layerName)
          update the Layer returns true if able to update
 com.bbn.openmap.LatLonPoint xyToLatLon(int x, int y)
          convert x, y points to a LatLonPoint this is really a conversion from the x,y location used to display a point on the display to the that LatLonPoint on the display
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OpenMapDisplay

public OpenMapDisplay()
Constructor for OpenMapDisplay, no title


OpenMapDisplay

public OpenMapDisplay(java.lang.String title)
Constructor for OpenMapDisplay, set title for OpenMap frame default background color


OpenMapDisplay

public OpenMapDisplay(java.lang.String title,
                      java.awt.Color backgroundColor)
Constructor for OpenMapDisplay, set title for OpenMap frame, set background color

Parameters:
title -
backgroundColor -

OpenMapDisplay

public OpenMapDisplay(java.lang.String title,
                      java.awt.Color backgroundColor,
                      boolean usePropertyFile)
Constructor for OpenMapDisplay, set title for OpenMap frame, set background color, can also set true if you want to use the openmap.properties file. Not recommended unless you understand how openmap.properies files work

Parameters:
title -
backgroundColor -
Method Detail

getModel

public SimModel getModel()
Gets the SimModel, if any, associated with this OpenMapDisplay.

Returns:

setModel

public void setModel(SimModel model)
Sets the SimModel to associate with this OpenMapDisplay.

Parameters:
model - the model to associate with this OpenMapDisplay

addGraticuleLayer

public void addGraticuleLayer()
add the Graticule layer to the map (shows lat/lon lines over the map)


centerMap

public void centerMap(com.bbn.openmap.LatLonPoint center)
center the map over a given LatLonPoint

Parameters:
center -

setMapScale

public void setMapScale(float scale)
set the scale of the map display

Parameters:
scale -

addLayer

public RepastOMLayer addLayer(java.util.List gisAgents,
                              java.lang.String title)
add a Layer of OpenMapAgents to the map display

Parameters:
OpenMapAgents -
Returns:
ShapeLayer

addLayer

public RepastOMLayer addLayer(java.util.List gisAgents,
                              java.lang.String title,
                              java.awt.Color highlightColor)
add a Layer of OpenMapAgents to the map display set the highlight color for use when the mouse moves over a an agent on the map

Parameters:
OpenMapAgents -
Returns:
ShapeLayer

addMultiLayer

public RepastOMMultiLayer addMultiLayer(java.util.List gisAgents,
                                        java.lang.String title)
add a Layer of MultiLayerOpenMapAgents to the map display

Parameters:
MultiLayerOpenMapAgents -
Returns:
ShapeLayer

addMultiLayer

public RepastOMMultiLayer addMultiLayer(java.util.List gisAgents,
                                        java.lang.String title,
                                        java.awt.Color highlightColor)
add a Layer of MultiLayerOpenMapAgent to the map display set the highlight color for use when the mouse moves over a an agent on the map

Parameters:
MultiLayerOpenMapAgents -
Returns:
ShapeLayer

updateDisplay

public void updateDisplay()
update all layers in the OpenMapDisplay


updateLayer

public boolean updateLayer(java.util.List gisAgents,
                           java.lang.String layerName)
update the Layer returns true if able to update

Parameters:
layerName -
Returns:

getLayer

public com.bbn.openmap.Layer getLayer(java.lang.String layerName)
return the specified layer

Parameters:
layerName -
Returns:
Layer

buildEsriGraphicList

public com.bbn.openmap.dataAccess.shape.EsriGraphicList buildEsriGraphicList(java.util.Collection gisAgents)
Takes a Collection of GisAgents, gets the OMGraphic from each, and attempts to build an EsriGraphicList from them.

Requires that the GisAgents OMGraphics can be casted to EsriGraphic

Parameters:
gisAgents -
Returns:
EsriGraphicList

getProjection

public com.bbn.openmap.proj.Projection getProjection()
get the current OpenMapProjection

Returns:
Projection

getProjection

public com.bbn.openmap.proj.Projection getProjection(java.lang.String layerName)
get the current projection for the specified layer

Parameters:
layerName -
Returns:
Projection

getProjection

public com.bbn.openmap.proj.Projection getProjection(com.bbn.openmap.Layer layer)
get the current projection for the specified layer

Parameters:
layer -
Returns:
Projection

latLonToPoint

public java.awt.Point latLonToPoint(com.bbn.openmap.LatLonPoint llp)
convert an OpenMap LatLonPoint to a point object this is really a conversion from the LatLonPoint on a map to the x,y location used to display that LatLonPoint on the display

Parameters:
llp -
Returns:
Point

pointToLatLon

public com.bbn.openmap.LatLonPoint pointToLatLon(java.awt.Point p)
convert a Point object to a LatLonPoint this is really a conversion from the x,y location used to display a point on the display to the that LatLonPoint on the display

Parameters:
p -
Returns:
Point

xyToLatLon

public com.bbn.openmap.LatLonPoint xyToLatLon(int x,
                                              int y)
convert x, y points to a LatLonPoint this is really a conversion from the x,y location used to display a point on the display to the that LatLonPoint on the display

Parameters:
x -
y -
Returns:
Point

findClosestAgents

public java.util.ArrayList findClosestAgents(int x,
                                             int y)
Parameters:
x -
y -
Returns:
an ArrayList of all closest agents from all RepastOMLayers

findClosestAgents

public java.util.ArrayList findClosestAgents(int x,
                                             int y,
                                             float limit)
given an x,y location returns list of closet agents from each layer

Parameters:
x -
y -
limit -
Returns:
list of GisAgents

addShapeLayer

public com.bbn.openmap.layer.shape.ShapeLayer addShapeLayer(java.lang.String datasource,
                                                            java.lang.String title)
adds a shapelayer using default settings

this is just for display of the shapefile, it does not set any agent attributes

Parameters:
datasource -
title -
Returns:

addShapeLayer

public com.bbn.openmap.layer.shape.ShapeLayer addShapeLayer(java.lang.String datasource,
                                                            java.lang.String title,
                                                            java.lang.String lineColor,
                                                            java.lang.String fillColor)
adds a shapelayer. Set line color and fillColor for the Features

this is just for display of the shapefile, it does not set any agent attributes

Parameters:
datasource -
title -
Returns:

dispose

public void dispose()
dispose of the OpenMap frame


getFrame

public com.bbn.openmap.gui.OpenMapFrame getFrame()

setFrame

public void setFrame(com.bbn.openmap.gui.OpenMapFrame frame)

getLayerHandler

public com.bbn.openmap.LayerHandler getLayerHandler()

setLayerHandler

public void setLayerHandler(com.bbn.openmap.LayerHandler layerHandler)

getLayers

public com.bbn.openmap.Layer[] getLayers()

setLayers

public void setLayers(com.bbn.openmap.Layer[] layers)

getMapBean

public com.bbn.openmap.MapBean getMapBean()

setMapBean

public void setMapBean(com.bbn.openmap.MapBean mapBean)

getMapHandler

public com.bbn.openmap.MapHandler getMapHandler()

setMapHandler

public void setMapHandler(com.bbn.openmap.MapHandler mapHandler)

getMapPanel

public com.bbn.openmap.gui.BasicMapPanel getMapPanel()

setMapPanel

public void setMapPanel(com.bbn.openmap.gui.BasicMapPanel mapPanel)

getHighlightColor

public java.awt.Color getHighlightColor()

setHighlightColor

public void setHighlightColor(java.awt.Color highlightColor)

getOpenMap

public com.bbn.openmap.app.OpenMap getOpenMap()

setOpenMap

public void setOpenMap(com.bbn.openmap.app.OpenMap openMap)

getPropertyHandler

public com.bbn.openmap.PropertyHandler getPropertyHandler()

setPropertyHandler

public void setPropertyHandler(com.bbn.openmap.PropertyHandler propertyHandler)

setMovieName

public void setMovieName(java.lang.String fileName,
                         java.lang.String movieType)
Sets the name and type of a movie. Currently type can only be DisplaySurface.QUICK_TIME.

Specified by:
setMovieName in interface MediaProducer
Parameters:
fileName - the name of the movie
movieType - the type of movie (e.g. DisplaySurface.QUICK_TIME)

addMovieFrame

public void addMovieFrame()
Adds the currently displayed image as frame to a movie. setMovieName must be called before this method is called.

Specified by:
addMovieFrame in interface MediaProducer

closeMovie

public void closeMovie()
Closes the movie, writing any remaining frames to the file. This must be called if making a movie.

Specified by:
closeMovie in interface MediaProducer

setSnapshotFileName

public void setSnapshotFileName(java.lang.String fileName)
Specified by:
setSnapshotFileName in interface MediaProducer

takeSnapshot

public void takeSnapshot()
Specified by:
takeSnapshot in interface MediaProducer