AgentMaps/docs/global.html
noncomputable 8f1ca23c2b Updates
2018-07-31 17:13:46 -04:00

2240 lines
26 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Global</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">Global</h1>
<section>
<header>
<h2></h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="agentify"><span class="type-signature"></span>agentify<span class="signature">(count, agentFeatureMaker)</span><span class="type-signature"></span></h4>
<div class="description">
Generate some number of agents and place them on the map.
</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>count</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The desired number of agents.</td>
</tr>
<tr>
<td class="name"><code>agentFeatureMaker</code></td>
<td class="type">
<span class="param-type"><a href="global.html#agentFeatureMaker">agentFeatureMaker</a></span>
</td>
<td class="description last">A callback that determines an agent i's feature properties and geometry (always a Point).</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#line48">line 48</a>
</li></ul></dd>
</dl>
<h4 class="name" id="agentmapFactory"><span class="type-signature"></span>agentmapFactory<span class="signature">(map)</span><span class="type-signature"> &rarr; {object}</span></h4>
<div class="description">
Generates an agentmap for the given map.
</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>map</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">A Leaflet Map instance.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="agentmap.js.html">agentmap.js</a>, <a href="agentmap.js.html#line228">line 228</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- An Agentmap instance.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
</dd>
</dl>
<h4 class="name" id="buildingify"><span class="type-signature"></span>buildingify<span class="signature">(bounding_box, OSM_data, OSM_data_URL)</span><span class="type-signature"></span></h4>
<div class="description">
Generate and setup the desired map features (e.g. streets, houses).
</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>bounding_box</code></td>
<td class="type">
<span class="param-type">Array.&lt;Array.&lt;number>></span>
</td>
<td class="description last">The map's top-left and bottom-right coordinates.</td>
</tr>
<tr>
<td class="name"><code>OSM_data</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">A GeoJSON Feature Collection object containing the OSM features inside the bounding box.</td>
</tr>
<tr>
<td class="name"><code>OSM_data_URL</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">URL from which to download equivalent OSM_data.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="buildings.js.html">buildings.js</a>, <a href="buildings.js.html#line19">line 19</a>
</li></ul></dd>
</dl>
<h4 class="name" id="getIntersections"><span class="type-signature"></span>getIntersections<span class="signature">(arr_a, arr_b, ids)</span><span class="type-signature"> &rarr; {Array.&lt;Array.&lt;(number|Object.&lt;number, number>)>>}</span></h4>
<div class="description">
Given two coordinate arrays, get their intersection.
</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>arr_a</code></td>
<td class="type">
<span class="param-type">array.&lt;array.&lt;number>></span>
</td>
<td class="description last">Array of coordinate pairs.</td>
</tr>
<tr>
<td class="name"><code>arr_b</code></td>
<td class="type">
<span class="param-type">array.&lt;array.&lt;number>></span>
</td>
<td class="description last">Array of coordinate pairs.</td>
</tr>
<tr>
<td class="name"><code>ids</code></td>
<td class="type">
<span class="param-type">array.&lt;number></span>
</td>
<td class="description last">2-element array whose elements are IDs for arr_a and arr_b respectively.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line82">line 82</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Array whose elements are the intersections' cooridinates if
ids is empty, or otherwise whose elements are arrays each of whose first element is an
intersection's coordinates and whose second element is an object mapping each array's ID (supplied by ids)
to the index of the intersecting coordinate-pair in that array.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;Array.&lt;(number|Object.&lt;number, number>)>></span>
</dd>
</dl>
<h4 class="name" id="isPointCoordinates"><span class="type-signature"></span>isPointCoordinates<span class="signature">(array)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
Given an array, check whether it can represent the coordinates of a point.
</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>array</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">Array to check.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line34">line 34</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Whether the array can be the coordinates of a point.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="layerCount"><span class="type-signature"></span>layerCount<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Returns the number of layers in a Leaflet layer group.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="agentmap.js.html">agentmap.js</a>, <a href="agentmap.js.html#line235">line 235</a>
</li></ul></dd>
</dl>
<h4 class="name" id="pointToCoordinateArray"><span class="type-signature"></span>pointToCoordinateArray<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;number>}</span></h4>
<div class="description">
Given either a GeoJSON feature, L.latLng, or coordinate array containing the coordinates of a point,
return an array of the coordinates.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line51">line 51</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Array of the point's coordinates. I.e.: [lng, lat].
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;number></span>
</dd>
</dl>
<h4 class="name" id="reversedCoordinates"><span class="type-signature"></span>reversedCoordinates<span class="signature">(coordinates)</span><span class="type-signature"> &rarr; {Array.&lt;(number|Array.&lt;(number|Array.&lt;number>)>)>}</span></h4>
<div class="description">
Given a geoJSON geometry object's coordinates, return the object, but with
all the coordinates reversed. <br /point.geometry && point.geometry.coordinates && >
Why? GeoJSON coordinates are in lngLat format by default, while Leaflet uses latLng.
L.geoJSON will auto-reverse the order of a GeoJSON object's coordinates, as it
expects geoJSON coordinates to be lngLat. However, normal, non-GeoJSON-specific Leaflet
methods expect Leaflet's latLng pairs and won't auto-reverse, so we have to do that
manually if we're preprocessing the GeoJSON data before passing it to L.geoJSON.
</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>coordinates</code></td>
<td class="type">
<span class="param-type">Array.&lt;(number|Array.&lt;(number|Array.&lt;number>)>)></span>
</td>
<td class="description last">GeoJSON coordinates for a point, (multi-)line, or (multi-)polygon.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line14">line 14</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Reversed geoJSON coordinates for a point, (multi-)line, or (multi-)polygon.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array.&lt;(number|Array.&lt;(number|Array.&lt;number>)>)></span>
</dd>
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id="agentFeatureMaker"><span class="type-signature"></span>agentFeatureMaker<span class="signature">(i)</span><span class="type-signature"> &rarr; (nullable) {<a href="global.html#Point">Point</a>}</span></h4>
<div class="description">
User-defined callback that gives a feature with appropriate geometry and properties to represent an agent.
</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>i</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">A number used to determine the agent's coordinates and other properties.</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#line12">line 12</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Either a GeoJSON Point feature with properties and coordinates for agent i, including
a "place" property that will define the agent's initial agent.place; or null, which will cause agentify
to immediately stop its work & terminate.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#Point">Point</a></span>
</dd>
</dl>
<h4 class="name" id="Feature">Feature</h4>
<div class="description">
A GeoJSON feature object.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Should be "Feature".</td>
</tr>
<tr>
<td class="name"><code>properties</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Non-geometric properties of the feature.</td>
</tr>
<tr>
<td class="name"><code>geometry</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Geometric properties of the feature (a GeoJSON spec of the feature's geometry).
<h6>Properties</h6>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The feature's GeoJSON geometry type.</td>
</tr>
<tr>
<td class="name"><code>coordinates</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">The coordinates specifying the feature's geometry.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="jsdocs.js.html">jsdocs.js</a>, <a href="jsdocs.js.html#line13">line 13</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="http://geojson.org/">http://geojson.org/</a></li>
</ul>
</dd>
</dl>
<h4 class="name" id="LatLng">LatLng</h4>
<div class="description">
Represents a latitude/longitude pair. Preferably an instance of L.LatLng:
<a href="https://leafletjs.com/reference-1.3.2.html#latlng">https://leafletjs.com/reference-1.3.2.html#latlng</a>.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">object</span>
</li>
</ul>
<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>lat</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last">A decimal latitude.</td>
</tr>
<tr>
<td class="name"><code>lng</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last">A decimal longitude.</td>
</tr>
<tr>
<td class="name"><code>new_place</code></td>
<td class="type">
<span class="param-type"><a href="global.html#Place">Place</a></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">A place (unit or street) associated with this LatLng.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="jsdocs.js.html">jsdocs.js</a>, <a href="jsdocs.js.html#line3">line 3</a>
</li></ul></dd>
</dl>
<h4 class="name" id="Place">Place</h4>
<div class="description">
A place representing either a unit or a street.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">object</span>
</li>
</ul>
<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>street</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">The ID of a street in the agentmap's street layer group.</td>
</tr>
<tr>
<td class="name"><code>unit</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">The ID of a unit in the agentmap's unit layer group.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="jsdocs.js.html">jsdocs.js</a>, <a href="jsdocs.js.html#line32">line 32</a>
</li></ul></dd>
</dl>
<h4 class="name" id="Point">Point</h4>
<div class="description">
A GeoJSON <a href="global.html#Feature">Feature</a> specifically for individual points.
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="global.html#Feature">Feature</a></span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>geometry.coordinates</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">A single array with 2 elements: [longitude, latitude].</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="jsdocs.js.html">jsdocs.js</a>, <a href="jsdocs.js.html#line25">line 25</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#agentmapFactory">agentmapFactory</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#layerCount">layerCount</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 Tue Jul 31 2018 17:04:58 GMT-0400 (Eastern Daylight Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>