AgentMaps/docs/Agent.html
noncomputable ac63cd6b0a Updates
2018-08-01 23:39:04 -04:00

867 lines
14 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Agent</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: Agent</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>Agent<span class="signature">(lat_lng, options, agentmap)</span><span class="type-signature"></span></h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="Agent"><span class="type-signature"></span>new Agent<span class="signature">(lat_lng, options, agentmap)</span><span class="type-signature"></span></h4>
<div class="description">
Constructor for the Agent class, using Leaflet class system.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>lat_lng</code></td>
<td class="type">
<span class="param-type"><a href="global.html#LatLng">LatLng</a></span>
</td>
<td class="description last">A pair of coordinates to place the agent at.</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">An array of options for the agent, namely its layer.</td>
</tr>
<tr>
<td class="name"><code>agentmap</code></td>
<td class="type">
<span class="param-type"><a href="Agentmap.html">Agentmap</a></span>
</td>
<td class="description last">The agentmap instance in which the agent exists.</td>
</tr>
</tbody>
</table>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>feature.AgentMap_id</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last">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.</td>
</tr>
<tr>
<td class="name"><code>agentmap</code></td>
<td class="type">
<span class="param-type"><a href="Agentmap.html">Agentmap</a></span>
</td>
<td class="attributes">
</td>
<td class="description last">The agentmap instance in which the agent exists.</td>
</tr>
<tr>
<td class="name"><code>place</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Place">Place</a></span>
</td>
<td class="attributes">
</td>
<td class="description last">A place object containing the id of the place (unit, street, etc.) where the agent is currently at.</td>
</tr>
<tr>
<td class="name"><code>travel_state</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="description last">Properties detailing information about the agent's trip that change sometimes, but needs to be accessed by future updates.
<h6>Properties</h6>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>traveling</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
</td>
<td class="description last">Whether the agent is currently on a trip.</td>
</tr>
<tr>
<td class="name"><code>current_point</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Point">Point</a></span>
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last">The point where the agent is currently located.</td>
</tr>
<tr>
<td class="name"><code>goal_point</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Point">Point</a></span>
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last">The point where the agent is traveling to.</td>
</tr>
<tr>
<td class="name"><code>lat_dir</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last">The latitudinal direction. -1 if traveling to lower latitude (down), 1 if traveling to higher latitude (up).</td>
</tr>
<tr>
<td class="name"><code>lng_dir</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last">The longitudinal direction. -1 if traveling to lesser longitude (left), 1 if traveling to greater longitude (right).</td>
</tr>
<tr>
<td class="name"><code>slope</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last">The slope of the line segment formed by the two points between which the agent is traveling at this time during its trip.</td>
</tr>
<tr>
<td class="name"><code>path</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
</td>
<td class="description last">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.</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>update_func</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last">Function to be called on each update.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="agents.js.html">agents.js</a>, <a href="agents.js.html#line91">line 91</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".setTravelToPlace"><span class="type-signature">(static) </span>setTravelToPlace<span class="signature">(goal_lat_lng, goal_place, replace_trip)</span><span class="type-signature"></span></h4>
<div class="description">
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).
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>goal_lat_lng</code></td>
<td class="type">
<span class="param-type"><a href="global.html#LatLng">LatLng</a></span>
</td>
<td class="description last">The point within the place to which the agent is to travel.</td>
</tr>
<tr>
<td class="name"><code>goal_place</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Place">Place</a></span>
</td>
<td class="description last">The place to which the agent will travel. Must be of form {"unit": unit_id} or {"street": street_id}.</td>
</tr>
<tr>
<td class="name"><code>replace_trip</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="description last">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).</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="agents.js.html">agents.js</a>, <a href="agents.js.html#line221">line 221</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Agent.html">Agent</a></li><li><a href="Agentmap.html">Agentmap</a></li></ul><h3>Global</h3><ul><li><a href="global.html#agentify">agentify</a></li><li><a href="global.html#agentmap">agentmap</a></li><li><a href="global.html#buildingify">buildingify</a></li><li><a href="global.html#getIntersections">getIntersections</a></li><li><a href="global.html#isPointCoordinates">isPointCoordinates</a></li><li><a href="global.html#pointToCoordinateArray">pointToCoordinateArray</a></li><li><a href="global.html#reversedCoordinates">reversedCoordinates</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Aug 01 2018 23:38:51 GMT-0400 (Eastern Daylight Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>