org.ascape.gis.model
Class MapAgent

java.lang.Object
  extended by org.ascape.model.AscapeObject
      extended by org.ascape.model.Agent
          extended by org.ascape.model.LocatedAgent
              extended by org.ascape.model.MomentumAgent
                  extended by org.ascape.gis.model.MapAgent
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Location, HasName, RandomFunctions
Direct Known Subclasses:
SubGraphAgent

public class MapAgent
extends MomentumAgent

See Also:
Serialized Form

Field Summary
protected  com.bbn.openmap.omGraphics.OMRaster graphic
          The wrapper class that OpenMap needs to place the actual image within.
protected  com.bbn.openmap.layer.location.Location location
          The location of the asset in continuous space.
protected  java.awt.Image mapImage
          The actual graphic representation of the asset on the map.
protected  double velocity
          The asset's velocity in nautical miles per hour.
 
Fields inherited from class org.ascape.model.MomentumAgent
heading
 
Fields inherited from class org.ascape.model.LocatedAgent
coordinate, MOVE_RANDOM_LOCATION_RULE, RANDOM_WALK_RULE, thisUpdate
 
Fields inherited from class org.ascape.model.Agent
DEATH_RULE, FISSIONING_RULE, FORCE_DIE_RULE, FORCE_FISSION_RULE, FORCE_MOVE_RULE, INITIALIZE_RULE, ITERATE_AND_UPDATE_RULE, ITERATE_RULE, METABOLISM_RULE, MOVEMENT_RULE, PLAY_OTHER, UPDATE_RULE
 
Fields inherited from class org.ascape.model.AscapeObject
ARBITRARY_SEED, name, scape
 
Constructor Summary
MapAgent()
           
 
Method Summary
 com.bbn.openmap.omGraphics.OMRaster getGraphic()
           
 java.awt.Image getImage()
          Gets the image for the MapAgent class.
 java.awt.Image getImage(java.lang.String imageName)
          Gets an image for the graphic from a file.
 java.awt.Image getImage(java.lang.String imageName, java.lang.String subDirectory)
          Gets an image for the graphic from a file.
 com.bbn.openmap.layer.location.Location getLocation()
          Gets the location for the MapAgent object.
 double getOffsetX()
          Returns the offset that the image should carry from the left.
 double getOffsetY()
           
 double getVelocity()
          Gets the MapAgent's velocity
 boolean isAt(MapCoordinate coordinate)
          Returns true if the MapAgent is at the location defined by the MapCoordinate passed in.
 void moveToward(Coordinate coordinate)
          Moves this MapAgent object closer to its destination
 void setCoordinate(Coordinate coordinate)
          Returns the extent of the nth dimension.
 void setGraphic(com.bbn.openmap.omGraphics.OMRaster graphic)
          Sets graphic for the MapAgent object.
 void setImage(java.awt.Image mapImage)
          Sets the image to be used when drawing.
 void setImage(java.lang.String imageName)
          Sets the image to be used when drawing.
 void setLocation(com.bbn.openmap.layer.location.Location location)
           
 void setOffsetX(double offsetX)
           
 void setOffsetY(double offsetY)
           
 void setVelocity(double vel)
          Sets the vehicle's velocity
 
Methods inherited from class org.ascape.model.MomentumAgent
findHeadingAway, findHeadingAway, findHeadingToward, findHeadingToward, getAgentSize, getHeading, headAway, headAway, headToward, headToward, movement, moveTo, moveTo, moveToRandomLocation, randomWalk, setAgentSize, setHeading, toString
 
Methods inherited from class org.ascape.model.LocatedAgent
calculateDistance, calculateDistance, countWithin, countWithin, countWithin, findMaximumWithin, findNearest, findNearest, findNearest, findNearest, findNearest, findWithin, findWithin, findWithin, findWithin, getCoordinate, hasWithin, hasWithin, hasWithin, initialize, isUpdateNeeded, moveAway, moveAway, moveAway, moveToward, moveToward, requestUpdate, requestUpdateNext
 
Methods inherited from class org.ascape.model.Agent
clearDeleteMarker, clone, death, deathCondition, die, execute, execute, fission, fissionCondition, fissioning, getColor, getColor, getImage, getIteration, getRoot, isDelete, isInitialized, iterate, markForDeletion, metabolism, move, movementCondition, play, scapeCreated, setInitialized, setScape, update
 
Methods inherited from class org.ascape.model.AscapeObject
diffDeep, diffDeep, diffDeepBFS, diffDeepDFS, diffDeepValidate, diffDeepVisit, equalsDeep, equalsDeep, equalsDeep, getComparisonStream, getName, getRandom, getRandomSeed, getScape, randomInRange, randomInRange, randomIs, randomToLimit, reseed, setComparisonStream, setName, setRandom, setRandomSeed
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ascape.model.space.Location
clearDeleteMarker, clone, isDelete, markForDeletion
 

Field Detail

graphic

protected com.bbn.openmap.omGraphics.OMRaster graphic
The wrapper class that OpenMap needs to place the actual image within.


location

protected com.bbn.openmap.layer.location.Location location
The location of the asset in continuous space.


velocity

protected double velocity
The asset's velocity in nautical miles per hour.


mapImage

protected java.awt.Image mapImage
The actual graphic representation of the asset on the map.

Constructor Detail

MapAgent

public MapAgent()
Method Detail

moveToward

public void moveToward(Coordinate coordinate)
Moves this MapAgent object closer to its destination

Overrides:
moveToward in class LocatedAgent
Parameters:
coordinate - the new location as a Coordinate

isAt

public boolean isAt(MapCoordinate coordinate)
Returns true if the MapAgent is at the location defined by the MapCoordinate passed in.

Parameters:
coordinate - The MapCoordinate where the MapAgent is being tested to be.
Returns:
True if the MapAgent is within a small distance of the MapCoordinate

getLocation

public com.bbn.openmap.layer.location.Location getLocation()
Gets the location for the MapAgent object.

Returns:
the location

getVelocity

public double getVelocity()
Gets the MapAgent's velocity

Overrides:
getVelocity in class MomentumAgent
Returns:
the velocity

setGraphic

public void setGraphic(com.bbn.openmap.omGraphics.OMRaster graphic)
Sets graphic for the MapAgent object.

Parameters:
graphic - the graphic

setCoordinate

public void setCoordinate(Coordinate coordinate)
Returns the extent of the nth dimension.

Specified by:
setCoordinate in interface Location
Overrides:
setCoordinate in class LocatedAgent
Parameters:
coordinate - the coordinate

setVelocity

public void setVelocity(double vel)
Sets the vehicle's velocity

Overrides:
setVelocity in class MomentumAgent
Parameters:
vel - the velocity

getImage

public java.awt.Image getImage(java.lang.String imageName)
Gets an image for the graphic from a file. By convention, assumed to be in lib hierarchy where the class file is, in the dat/ directory.

Parameters:
imageName - parameter
Returns:
the image

getImage

public java.awt.Image getImage(java.lang.String imageName,
                               java.lang.String subDirectory)
Gets an image for the graphic from a file. By convention, assumed to be in lib hierarchy where the class file is, in the dat/ directory.

Parameters:
imageName - parameter
Returns:
the image

getOffsetX

public double getOffsetX()
Returns the offset that the image should carry from the left. Normally half of the image width.


setOffsetX

public void setOffsetX(double offsetX)

getOffsetY

public double getOffsetY()

setOffsetY

public void setOffsetY(double offsetY)

getGraphic

public com.bbn.openmap.omGraphics.OMRaster getGraphic()

getImage

public java.awt.Image getImage()
Gets the image for the MapAgent class.

Overrides:
getImage in class Agent
Returns:
the image

setLocation

public void setLocation(com.bbn.openmap.layer.location.Location location)

setImage

public void setImage(java.awt.Image mapImage)
Sets the image to be used when drawing.

Parameters:
mapImage - the image to draw

setImage

public void setImage(java.lang.String imageName)
Sets the image to be used when drawing.

Parameters:
imageName - the image to draw


Copyright © 1998-2008 The Brookings Institution, NuTech Solutions, Metascape, LLC All Rights Reserved.