Class: Agent

Agent(lat_lng, options, agentmap)

new Agent(lat_lng, options, agentmap)

Constructor for the Agent class, using Leaflet class system.
Parameters:
Name Type Description
lat_lng LatLng 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 Default Description
agentmap Agentmap The agentmap instance in which the agent exists.
place Place A place object specifying where the agent is currently at.
steps_made number <optional>
0 The number of steps the agent has moved since the beginning.
this.trip 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
moving boolean Whether the agent currently moving.
paused boolean Whether the agent should be allowed to move along its 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).
speed number <nullable>
The speed that the agent should travel, in meters per tick.
angle number <nullable>
The angle between the current point and the goal.
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 trip is changed/reset.
controller function <nullable>
User-defined function to be called on each update (each tick).
fine_controller function <nullable>
User-defined function to be called before & after each movemnt (on each step an agent performs during a tick).
Source:

Members

scheduleTrip

Schedule the agent to travel directly from any point (e.g. of a street or unit) to a point (e.g. of another street or unit).
Source:

Methods

(static) checkSpeed(speed)

Check whether a given speed is greater than the minimum.
Parameters:
Name Type Description
speed number A number representing the speed of an agent in meters per second.
Source:

(static) increaseSpeed(magnitude)

Increase the speed the agent moves along its currently scheduled path by a constant.
Parameters:
Name Type Description
magnitude number The number to add to the agent's scheduled speed. All scheduled speeds must be >= .1
Source:

(static) moveIt()

Make the agent proceed along its trip.
Source:

(static) multiplySpeed(multiplier)

Multiply the speed the agent moves along its currently scheduled path by a constant.
Parameters:
Name Type Description
multiplier number The number to multiply the agent's scheduled speed by. All scheduled speeds must be >= .1.
Source:

(static) pauseTrip()

Stop the agent where it is along its trip.
Source:

(static) resetTrip()

Reset all the properties of its trip, but don't change whether it's allowed to be traveling or not.
Source:

(static) resumeTrip()

Have the agent continue from where it was left off along its trip.
Source:

(static) setSpeed(speed)

Set a new, constant speed for the agent to move along its currently scheduled path.
Parameters:
Name Type Description
speed number The speed (in meters per tick) that the agent should move. Must be >= .1.
Source:

(static) startTrip()

Set the agent up to start traveling along the path specified in the agent's trip..
Source: