new Agentmap(map)
The main class for building, storing, simulating, and manipulating agent-based models on Leaflet maps.
Parameters:
| Name | Type | Description |
|---|---|---|
map |
object | A Leaflet Map instance. |
Properties:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
map |
object | A Leaflet Map instance. | |||||||||||||||||||||||||||||||||
agents |
featureGroup | A featureGroup containing all agents. | |||||||||||||||||||||||||||||||||
units |
featureGroup | A featureGroup containing all units. | |||||||||||||||||||||||||||||||||
streets |
featureGroup | A featureGroup containing all streets. | |||||||||||||||||||||||||||||||||
state |
object | Properties detailing the state of the simulation process.
Properties
|
|||||||||||||||||||||||||||||||||
settings |
object | Settings for the agentmap, filled with defaults.
Properties
|
|||||||||||||||||||||||||||||||||
update_func |
function |
<nullable> |
Function to be called on each update. |
- Source:
Methods
(static) agent()
Returns an agent object.
(static) seqUnitAgentMaker()
A standard featureMaker callback, which sets an agent's location as the center of a unit on the map.
getNearestIntersection(lat_lng, place) → {LatLng}
Given a point on a street, find the nearest intersection on that street (with any other street).
Parameters:
| Name | Type | Description |
|---|---|---|
lat_lng |
LatLng | The coordinates of the point on the street to search from. |
place |
Place | A place object corresponding to the street. |
- Source:
Returns:
- The coordinates of the nearest intersection.
- Type
- LatLng
getStreetNearDoor(unit_id) → {LatLng}
Get the point on the adjacent street in front of the unit's door.
Parameters:
| Name | Type | Description |
|---|---|---|
unit_id |
number | The unique id of the unit whose door's corresponding point on the street you want. |
- Source:
Returns:
- The coordinates point of the adjacent street directly in front of unit's door.
- Type
- LatLng
getUnitDoor(unit_id) → {LatLng}
Get a point through which an agent can exit/enter a unit.
Parameters:
| Name | Type | Description |
|---|---|---|
unit_id |
number | The unique id of the unit whose door you want. |
- Source:
Returns:
- The coordinates of the center point of the segment of the unit parallel to the street.
- Type
- LatLng
pause()
Stop the animation, stop updating the agents.
- Source:
reset()
Stop the animation, reset the animation state properties, and delete the agents.
- Source:
run()
Get an animation frame, have the agents update & get ready to be drawn, and keep doing that until paused or reset.
- Source: