new Agent(latLng, options, agentmap)
Constructor for the Agent class, using Leaflet class system.
Parameters:
| Name | Type | Description |
|---|---|---|
latLng |
Array | A pair of coordinates to place the agent at. |
options |
Object | An array of options for the agent, namely its layer. |
agentmap |
Agentmap | The agentmap instance in which the agent exists. |
Properties:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
feature.AgentMap_id |
number | The agent's instance id, so it can be accessed from inside the Leaflet layer. To avoid putting the actual instance inside the feature object. | |||||||||||||||||||||||||||||||||
agentmap |
Agentmap | The agentmap instance in which the agent exists. | |||||||||||||||||||||||||||||||||
place |
Object.<string, number> | The id of the place (unit, street, etc.) where the agent is currently at. | |||||||||||||||||||||||||||||||||
travel_state |
Object | Properties detailing information about the agent's trip that change sometimes, but needs to be accessed by future updates.
Properties
|
|||||||||||||||||||||||||||||||||
update_func |
function |
<nullable> |
Function to be called on each update. |
Methods
(static) setTravelToPlace(goal_lat_lng, goal_place, replace_trip)
Set the agent up to travel directly from any point (e.g. of a street or unit) to a point (e.g. of another street or unit).
Parameters:
| Name | Type | Description |
|---|---|---|
goal_lat_lng |
LatLng | The point within the place to which the agent is to travel. |
goal_place |
Object.<string, number> | The place to which the agent will travel. Must be of form {"unit": unit_id} or {"street": street_id}. |
replace_trip |
Boolean | Whether to empty the currently scheduled path and replace it with this new trip; false by default (the new trip is simply appended to the current scheduled path). |