|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdd.sim.SimObject
dd.sim.Map
The current geographic region of interest. In the disaster simulation, the map is the core simulation object. The map represents the region that is currently being simulated. The map is divided geographically into smaller hexagonal regions called MapCells, and is conceptually divided into Layers. Although the map is two-dimensional, layers may be used to add three-dimensional information to each cell. The map is responsible for keeping track of cells and layers.
There are several ways to refer to locations within the Map. Internally, a Map consists of rows and columns. Rows refer to the height of the map and the vertical (north/south) distance. Columns refer to the width of the map and horizontal (east/west) distance. Row and column refer to the internal map coordinate numbering system, whereas X and Y or latitude and longitude refer to the geographic coordinates in which cells of the map live.
Field Summary | |
static java.lang.String |
CELL
|
static java.lang.String |
EUCLIDEAN
|
Fields inherited from class dd.sim.SimObject |
attributes |
Constructor Summary | |
Map()
Create a new (empty) map. |
|
Map(int rows,
int columns)
Creates a new map of specified size. |
Method Summary | |
void |
addLayer(Layer layer)
Adds a layer to the map. |
int |
cDistanceBetweenCells(MapCell cell1,
MapCell cell2)
Computes the cell distance between two cells. |
MapCell |
cellAt(int row,
int column)
Returns the cell at the specified internal coordinates. |
MapCell |
cellAt(java.lang.String cellName)
Returns the cell at the internal coordinates specified by name in the form " |
java.util.Collection |
cellsWithin(MapCell cell,
int distance)
Returns all the cells within a radius of the cell specified. |
void |
copyLayer(java.lang.String sourceLayerName,
java.lang.String targetLayerName)
Duplicates a layer by giving it a new name. |
Layer |
createLayer(java.lang.String layerName)
Creates and adds a layer to the map. |
double |
distanceBetweenCells(MapCell cell1,
MapCell cell2,
java.lang.String type)
|
double |
eDistanceBetweenCells(MapCell cell1,
MapCell cell2)
Computes the Euclidean distance between two cells. |
float |
getAttribute(java.lang.String layerName,
MapCell cell,
java.lang.String attributeName)
Retrieves the value of an attribute for a specific layer and specific cell. |
float |
getAttribute(java.lang.String layerName,
MapCell cell,
java.lang.String attributeName,
float defaultValue)
Retrieves the value of an attribute for a specific layer and specific cell. |
java.util.Collection |
getCells()
Returns all the cells in the map. |
java.util.ArrayList |
getCells(java.lang.String[] sites)
Returns an ArrayList containing the mapCells specified by name (in the form " |
Layer |
getLayer(java.lang.String layerName)
Returns the layer with the name specified. |
java.util.Collection |
getLayers()
Returns all layers on this map. |
int |
getMapHeight()
Returns the height of the map. |
int |
getMapWidth()
Returns the width of the map. |
java.util.Collection |
getNeighbors(MapCell cell)
Returns a collection of neighbors of the specified cell. |
java.lang.Object |
getObjectAttribute(java.lang.String layerName,
MapCell cell,
java.lang.String attributeName)
Retrieves the value of an attribute for a specific layer and specific cell. |
int |
luCount(java.lang.String landuse)
As luCount(landuse, layer), on the "landuse" layer. |
int |
luCount(java.lang.String landuse,
java.util.Collection c)
As luCount(landuse, collection, layer), on the "landuse" layer. |
int |
luCount(java.lang.String landuse,
java.util.Collection c,
Layer layer)
As luCount(landuse, cell, layer), but summeed over all the MapCells specified in the given Collection. |
int |
luCount(java.lang.String landuse,
Layer layer)
As luCount(landuse, cell, layer), but summed over the entire Map. |
int |
luCount(java.lang.String landuse,
MapCell cell)
As luCount(landuse, cell, layer), on the "landuse" layer. |
int |
luCount(java.lang.String landuse,
MapCell cell,
Layer layer)
Returns the number of landuses (count of luArray items equal to landuse) in the given Cell on the given Layer of the Map. |
static void |
main(java.lang.String[] args)
Runs a test of Map functionality. |
void |
makeCache()
Creates the cell cache. |
MapCell |
northEastOf(MapCell cell)
Returns the cell northeast of the cell specified. |
MapCell |
northOf(MapCell cell)
Returns the cell north of the cell specified. |
MapCell |
northWestOf(MapCell cell)
Returns the cell northwest of the cell specified. |
void |
setAttribute(java.lang.String layerName,
MapCell cell,
java.lang.String attributeName,
float value)
Sets the attribute associated with a specified layer and cell. |
void |
setCellAt(int row,
int column,
MapCell cell)
Adds a cell to the map at the specified coordinates. |
MapCell |
southEastOf(MapCell cell)
Returns the cell southeast of the cell specified. |
MapCell |
southOf(MapCell cell)
Returns the cell south of the cell specified. |
MapCell |
southWestOf(MapCell cell)
Returns the cell southwest of the cell specified. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String EUCLIDEAN
public static final java.lang.String CELL
Constructor Detail |
public Map()
public Map(int rows, int columns)
rows
- number of cells tall the resulting map should becolumns
- number of cells wide the resulting map should beMethod Detail |
public int getMapWidth()
public int getMapHeight()
public void makeCache()
public Layer createLayer(java.lang.String layerName)
layerName
- name of the layer to create
public void copyLayer(java.lang.String sourceLayerName, java.lang.String targetLayerName)
sourceLayerName
- name of the layer to copytargetLayerName
- name of the new layer to createpublic void addLayer(Layer layer)
createLayer
method.
layer
- layer to add to the mappublic java.util.Collection getCells()
public java.util.Collection getLayers()
public MapCell cellAt(int row, int column)
row
- row (in internal Map coordinates) of the cellcolumn
- column (in internal Map coordinates) of the cell
null
if
the coordinates are invalid or there is no cell at that locationpublic MapCell cellAt(java.lang.String cellName)
public java.util.ArrayList getCells(java.lang.String[] sites)
public void setCellAt(int row, int column, MapCell cell)
row
- row (in internal Map coordinates) of the cellcolumn
- column (in internal Map coordinates) of the cellcell
- cell to be added to the mapmakeCache()
public MapCell northOf(MapCell cell)
cell
- cell whose neighbor should be retrieved
null
if it
does not exist.public MapCell southOf(MapCell cell)
cell
- cell whose neighbor should be retrieved
null
if it
does not exist.public MapCell northEastOf(MapCell cell)
cell
- cell whose neighbor should be retrieved
null
if it
does not exist.public MapCell northWestOf(MapCell cell)
cell
- cell whose neighbor should be retrieved
null
if it
does not exist.public MapCell southEastOf(MapCell cell)
cell
- cell whose neighbor should be retrieved
null
if it
does not exist.public MapCell southWestOf(MapCell cell)
cell
- cell whose neighbor should be retrieved
null
if it
does not exist.public java.util.Collection getNeighbors(MapCell cell)
cell
- cell whose neighbors should be retrieved
public double eDistanceBetweenCells(MapCell cell1, MapCell cell2)
cell1
- origin to compare distancecell2
- destination to compute distance
public int cDistanceBetweenCells(MapCell cell1, MapCell cell2)
cell1
- origin to compare distancecell2
- destination to compute distance
public double distanceBetweenCells(MapCell cell1, MapCell cell2, java.lang.String type)
public java.util.Collection cellsWithin(MapCell cell, int distance)
cell
- center celldistance
- geographic (Cartesian) distance to the furthest cell
cDistanceBetweenCells(MapCell,MapCell)
public Layer getLayer(java.lang.String layerName)
createLayer
but does not create a new
layer if it does not already exist.
layerName
- name of the layer to retrieve from the map
null
if the
map does not have a cell with this layer.public float getAttribute(java.lang.String layerName, MapCell cell, java.lang.String attributeName)
getObjectAttribute
method, which shares the same variables. This method is equivalent to
cell.getAttribute(attributeName,
this.getLayer(layerName))
layerName
- the layer on which the attribute is storedcell
- the cell in which the attribute is storedattributeName
- the name of the attribute to return
java.util.NoSuchElementException
- if there is no attribute with that name
associated with that layer.public float getAttribute(java.lang.String layerName, MapCell cell, java.lang.String attributeName, float defaultValue)
getObjectAttribute
method, which shares the same variables. This method is equivalent to
cell.getAttribute(attributeName,
this.getLayer(layerName), defaultValue)
layerName
- the layer on which the attribute is storedcell
- the cell in which the attribute is storedattributeName
- the name of the attribute to returndefaultValue
- default if the attribute does not exist
public java.lang.Object getObjectAttribute(java.lang.String layerName, MapCell cell, java.lang.String attributeName)
layerName
- the layer on which the attribute is storedcell
- the cell in which the attribute is storedattributeName
- the name of the attribute to return
null
if the attribute does not existpublic void setAttribute(java.lang.String layerName, MapCell cell, java.lang.String attributeName, float value)
layerName
- layer on which the attribute should existcell
- the cell into which the attribute should be storedattributeName
- name of the attribute to setvalue
- value to which the attribute should be setPropertyChangeEvent
public int luCount(java.lang.String landuse, Layer layer)
public int luCount(java.lang.String landuse, java.util.Collection c, Layer layer)
c
- a Collection of MapCells to total landuse over.public int luCount(java.lang.String landuse, MapCell cell, Layer layer)
landuse
- the landuse to tally. In addition to the normal
landuses, the pseudo-landuse "all" is overloaded to return the
sum of house, hotel, store, and condo landuses. Yeah, it's
hacky, but it's useful until the general cleanup of rescaling
happens.public int luCount(java.lang.String landuse)
public int luCount(java.lang.String landuse, java.util.Collection c)
public int luCount(java.lang.String landuse, MapCell cell)
public static void main(java.lang.String[] args)
args
- command-line arguments, currently ignored
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |