mirror of
https://github.com/noncomputable/AgentMaps.git
synced 2026-01-25 16:46:38 +00:00
updates jsdocs
This commit is contained in:
parent
9c3ea0738a
commit
a07ab00a56
@ -6,6 +6,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"bundle": "npx webpack",
|
||||
"prepublish": "npm run bundle",
|
||||
"make-docs": "jsdoc src site/docs/DOCS.md -d site/docs",
|
||||
"publish-pages": "gh-pages -d site"
|
||||
},
|
||||
"main": "src/index.js",
|
||||
|
||||
@ -10,14 +10,7 @@ encodeLatLng = require('./routing').encodeLatLng;
|
||||
/* Here we define agentify, the agent base class, and all other functions and definitions they rely on. */
|
||||
|
||||
/**
|
||||
* @typedef {Feature} Point
|
||||
* @property {Array} geometry.coordinates - This should be a single array with 2 elements: the point's coordinates.
|
||||
*
|
||||
* An extension of {@link Feature} for points.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Callback that gives a feature with appropriate geometry and properties to represent an agent.
|
||||
* User-defined callback that gives a feature with appropriate geometry and properties to represent an agent.
|
||||
*
|
||||
* @callback agentFeatureMaker
|
||||
* @param {number} i - A number used to determine the agent's coordinates and other properties.
|
||||
@ -29,6 +22,7 @@ encodeLatLng = require('./routing').encodeLatLng;
|
||||
/**
|
||||
* A standard featureMaker callback, which sets an agent's location as the center of a unit on the map.
|
||||
*
|
||||
* @memberof Agentmap
|
||||
* @type {agentFeatureMaker}
|
||||
*/
|
||||
function seqUnitAgentMaker(i){
|
||||
@ -88,6 +82,7 @@ function agentify(count, agentFeatureMaker) {
|
||||
|
||||
/**
|
||||
* The main class representing individual agents, using Leaflet class system.
|
||||
* @private
|
||||
*
|
||||
* @class Agent
|
||||
*/
|
||||
@ -95,7 +90,8 @@ let Agent = L.Layer.extend({});
|
||||
|
||||
/**
|
||||
* Constructor for the Agent class, using Leaflet class system.
|
||||
*
|
||||
*
|
||||
* @name Agent
|
||||
* @constructor
|
||||
* @param {Array} latLng - A pair of coordinates to place the agent at.
|
||||
* @param {Object} options - An array of options for the agent, namely its layer.
|
||||
@ -423,6 +419,7 @@ Agent.moveDirectly = function(animation_interval, intermediary_interval, steps_i
|
||||
//Intermediary movements.
|
||||
for (let i = 0; i < steps_inbetween; ++i) {
|
||||
move(intermediary_interval);
|
||||
|
||||
if (state.traveling === false) {
|
||||
return;
|
||||
}
|
||||
@ -454,6 +451,8 @@ Agent.update = function(animation_interval, intermediary_interval, steps_inbetwe
|
||||
|
||||
/**
|
||||
* Returns an agent object.
|
||||
*
|
||||
* @memberof Agentmap
|
||||
*/
|
||||
function agent(feature, options, agentmap) {
|
||||
return new L.A.Agent(feature, options, agentmap);
|
||||
|
||||
@ -9,16 +9,6 @@ getPathFinder = require('./routing').getPathFinder;
|
||||
|
||||
/* Here we define buildingify and all other functions and definitions it relies on. */
|
||||
|
||||
/**
|
||||
* @typedef {object} Feature
|
||||
* @property {string} type - Should be Feature.
|
||||
* @property {object} properties - Non-geometric properties describing the map feature.
|
||||
* @property {object} geometry - Specification of the feature's geometry.
|
||||
* @property {string} geometry.type - The feature's GeoJSON geometry type
|
||||
* @property {Array} geometry.coordinates - The coordinates specifying the feature's geometry.
|
||||
* @see {@link http://geojson.org/}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generate and setup the desired map features (e.g. streets, houses).
|
||||
*
|
||||
|
||||
38
src/jsdocs.js
Normal file
38
src/jsdocs.js
Normal file
@ -0,0 +1,38 @@
|
||||
/* Extra JSDocs that aren't particular to any module */
|
||||
|
||||
/**
|
||||
* Represents a latitude/longitude pair. Preferably an instance of L.LatLng:
|
||||
* {@link https://leafletjs.com/reference-1.3.2.html#latlng}.
|
||||
*
|
||||
* @typedef {object} LatLng
|
||||
* @property {number} lat - A decimal latitude.
|
||||
* @property {number} lng - A decimal longitude.
|
||||
* @property {Place} [new_place] - A place (unit or street) associated with this LatLng.
|
||||
*/
|
||||
|
||||
/**
|
||||
* A GeoJSON feature object.
|
||||
*
|
||||
* @typedef {object} Feature
|
||||
* @property {string} type - Should be "Feature".
|
||||
* @property {object} properties - Non-geometric properties of the feature.
|
||||
* @property {object} geometry - Geometric properties of the feature (a GeoJSON spec of the feature's geometry).
|
||||
* @property {string} geometry.type - The feature's GeoJSON geometry type.
|
||||
* @property {Array} geometry.coordinates - The coordinates specifying the feature's geometry.
|
||||
* @see {@link http://geojson.org/}
|
||||
*/
|
||||
|
||||
/**
|
||||
* A GeoJSON {@link Feature} specifically for individual points.
|
||||
*
|
||||
* @typedef {Feature} Point
|
||||
* @property {Array} geometry.coordinates - A single array with 2 elements: [longitude, latitude].
|
||||
*/
|
||||
|
||||
/**
|
||||
* A place representing either a unit or a street.
|
||||
*
|
||||
* @typedef {object} Place
|
||||
* @property {number} [street] - The ID of a street in the agentmap's street layer group.
|
||||
* @property {number} [unit] - The ID of a unit in the agentmap's unit layer group.
|
||||
*/
|
||||
Loading…
x
Reference in New Issue
Block a user