Class: Agent

Agent(latLng, options, agentmap)

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
Name Type Attributes Description
traveling boolean Whether the agent is currently on a trip.
current_point Point <nullable>
The point where the agent is currently located.
goal_point Point <nullable>
The point where the agent is traveling to.
lat_dir number <nullable>
The latitudinal direction. -1 if traveling to lower latitude (down), 1 if traveling to higher latitude (up).
lng_dir number <nullable>
The longitudinal direction. -1 if traveling to lesser longitude (left), 1 if traveling to greater longitude (right).
slope number <nullable>
The slope of the line segment formed by the two points between which the agent is traveling at this time during its trip.
path Array A sequence of LatLngs; the agent will move from one to the next, popping each one off after it arrives until the end of the street; or, until the travel_state is changed/reset.
update_func function <nullable>
Function to be called on each update.
Source:

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).
Source: