cacatoo
Version:
Building, exploring, and sharing spatially structured models
3,996 lines (991 loc) • 84.3 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Simulation</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: Simulation</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>Simulation<span class="signature">(config)</span><span class="type-signature"></span></h2>
<div class="class-description">Simulation is the global class of Cacatoo, containing the main configuration
for making a grid-based model and displaying it in either browser or with
nodejs.</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="Simulation"><span class="type-signature"></span>new Simulation<span class="signature">(config)</span><span class="type-signature"></span></h4>
<div class="description">
The constructor function for a @Simulation object. Takes a config dictionary.
and sets options accordingly.
</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>config</code></td>
<td class="type">
<span class="param-type">dictionary</span>
</td>
<td class="description last">A dictionary (object) with all the necessary settings to setup a Cacatoo simulation.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line3128">line 3128</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="addButton"><span class="type-signature"></span>addButton<span class="signature">(text, func)</span><span class="type-signature"></span></h4>
<div class="description">
addButton adds a HTML button which can be linked to a function by the user.
</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>text</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Text displayed on the button</td>
</tr>
<tr>
<td class="name"><code>func</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Function to be linked to the button</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line3875">line 3875</a>
</li></ul></dd>
</dl>
<h4 class="name" id="addCheckpointButton"><span class="type-signature"></span>addCheckpointButton<span class="signature">({@GridModel})</span><span class="type-signature"></span></h4>
<div class="description">
addCheckpointButton adds a button to the HTML environment which allows the user
to reload the grid to the state as found in a JSON file saved by save_grid. The JSON
file must of course match the simulation (nrows, ncols, properties in gps), but this
is the users own responsibility.
</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>{@GridModel}</code></td>
<td class="type">
</td>
<td class="description last">targetgrid The gridmodel containing the grid to reload the grid.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line4425">line 4425</a>
</li></ul></dd>
</dl>
<h4 class="name" id="addCustomSlider"><span class="type-signature"></span>addCustomSlider<span class="signature">(func, min<span class="signature-attributes">opt</span>, max<span class="signature-attributes">opt</span>, step<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
addCustomSlider adds a HTML slider to the DOM-environment which allows the user
to add a custom callback function to a slider
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>func</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">The name of the (global!) parameter to link to the slider</td>
</tr>
<tr>
<td class="name"><code>min</code></td>
<td class="type">
<span class="param-type">float</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
0
</td>
<td class="description last">Minimal value of the slider</td>
</tr>
<tr>
<td class="name"><code>max</code></td>
<td class="type">
<span class="param-type">float</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
2
</td>
<td class="description last">Maximum value of the slider</td>
</tr>
<tr>
<td class="name"><code>step</code></td>
<td class="type">
<span class="param-type">float</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
0.01
</td>
<td class="description last">Step-size when modifying</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line3944">line 3944</a>
</li></ul></dd>
</dl>
<h4 class="name" id="addHTML"><span class="type-signature"></span>addHTML<span class="signature">(div, html)</span><span class="type-signature"></span></h4>
<div class="description">
Adds some html to an existing DIV in your web page.
</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>div</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Name of DIV to add to</td>
</tr>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">HTML code to add</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line4091">line 4091</a>
</li></ul></dd>
</dl>
<h4 class="name" id="addMovieButton"><span class="type-signature"></span>addMovieButton<span class="signature">({@Model}, property)</span><span class="type-signature"></span></h4>
<div class="description">
addMovieButton adds a standard button to record a video
</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>{@Model}</code></td>
<td class="type">
</td>
<td class="description last">model (@Gridmodel of @Flockmodel) containing the canvas to be recorded.</td>
</tr>
<tr>
<td class="name"><code>property</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The name of the display (canvas) to be recorded</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line4354">line 4354</a>
</li></ul></dd>
</dl>
<h4 class="name" id="addObjectbrush"><span class="type-signature"></span>addObjectbrush<span class="signature">(gridmodel, obj, brushsize, brushflow, canvas)</span><span class="type-signature"></span></h4>
<div class="description">
Add an object-drawing posibility to this canvas
</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>gridmodel</code></td>
<td class="type">
<span class="param-type"><a href="Gridmodel.html">Gridmodel</a></span>
</td>
<td class="description last">The gridmodel to which this canvas belongs</td>
</tr>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Replace current gp with this object</td>
</tr>
<tr>
<td class="name"><code>brushsize</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last">radius of the brush</td>
</tr>
<tr>
<td class="name"><code>brushflow</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last">amounts of substeps taken (1 by default)</td>
</tr>
<tr>
<td class="name"><code>canvas</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">alternative canvas name to draw on (first canvas by default)</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line4205">line 4205</a>
</li></ul></dd>
</dl>
<h4 class="name" id="addPatternButton"><span class="type-signature"></span>addPatternButton<span class="signature">({@GridModel}, property)</span><span class="type-signature"></span></h4>
<div class="description">
addPatternButton adds a pattern button to the HTML environment which allows the user
to load a PNG which then sets the state of 'proparty' for the @GridModel.
(currently only supports black and white image)
</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>{@GridModel}</code></td>
<td class="type">
</td>
<td class="description last">targetgrid The gridmodel containing the grid to be modified.</td>
</tr>
<tr>
<td class="name"><code>property</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The name of the state to be set</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line4367">line 4367</a>
</li></ul></dd>
</dl>
<h4 class="name" id="addSlider"><span class="type-signature"></span>addSlider<span class="signature">(parameter, min<span class="signature-attributes">opt</span>, max<span class="signature-attributes">opt</span>, step<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
addSlider adds a HTML slider to the DOM-environment which allows the user
to modify a model parameter at runtime.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>parameter</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">The name of the (global!) parameter to link to the slider</td>
</tr>
<tr>
<td class="name"><code>min</code></td>
<td class="type">
<span class="param-type">float</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
0
</td>
<td class="description last">Minimal value of the slider</td>
</tr>
<tr>
<td class="name"><code>max</code></td>
<td class="type">
<span class="param-type">float</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
2
</td>
<td class="description last">Maximum value of the slider</td>
</tr>
<tr>
<td class="name"><code>step</code></td>
<td class="type">
<span class="param-type">float</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
0.01
</td>
<td class="description last">Step-size when modifying</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line3892">line 3892</a>
</li></ul></dd>
</dl>
<h4 class="name" id="addStatebrush"><span class="type-signature"></span>addStatebrush<span class="signature">(gridmodel, property, value_to_place, brushsize, brushflow)</span><span class="type-signature"></span></h4>
<div class="description">
Add a statedrawing posibility to this canvas
</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>gridmodel</code></td>
<td class="type">
<span class="param-type"><a href="Gridmodel.html">Gridmodel</a></span>
</td>
<td class="description last">The gridmodel to which this canvas belongs</td>
</tr>
<tr>
<td class="name"><code>property</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">the property that should be shown on the canvas</td>
</tr>
<tr>
<td class="name"><code>value_to_place</code></td>
<td class="type">
</td>
<td class="description last">set @property to this value</td>
</tr>
<tr>
<td class="name"><code>brushsize</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last">radius of the brush</td>
</tr>
<tr>
<td class="name"><code>brushflow</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last">amounts of substeps taken (1 by default)</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line4106">line 4106</a>
</li></ul></dd>
</dl>
<h4 class="name" id="addToggle"><span class="type-signature"></span>addToggle<span class="signature">(parameter)</span><span class="type-signature"></span></h4>
<div class="description">
addToggle adds a HTML checkbox element to the DOM-environment which allows the user
to flip boolean values
</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>parameter</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The name of the (global!) boolean to link to the checkbox</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line4064">line 4064</a>
</li></ul></dd>
</dl>
<h4 class="name" id="colourRamp"><span class="type-signature"></span>colourRamp<span class="signature">(arr1, arr2, n)</span><span class="type-signature"> → {dict}</span></h4>
<div class="description">
colourRamp interpolates between two arrays to get a smooth colour scale.
</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>arr1</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last">Array of R,G,B values to start fromtargetgrid The gridmodel containing the grid to be modified.</td>
</tr>
<tr>
<td class="name"><code>arr2</code></td>
<td class="type">
<span class="param-type">array</span>
</td>
<td class="description last">Array of R,B,B values to transition towards</td>
</tr>
<tr>
<td class="name"><code>n</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">number of steps taken</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line4522">line 4522</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
A dictionary (i.e. named JS object) of colours
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">dict</span>
</dd>
</dl>
<h4 class="name" id="createDisplay"><span class="type-signature"></span>createDisplay<span class="signature">(name, property, customlab, height, width, scale)</span><span class="type-signature"></span></h4>
<div class="description">
Create a display for a gridmodel, showing a certain property on it.
</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>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The name of an existing gridmodel to display</td>
</tr>
<tr>
<td class="name"><code>property</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The name of the property to display</td>
</tr>
<tr>
<td class="name"><code>customlab</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Overwrite the display name with something more descriptive</td>
</tr>
<tr>
<td class="name"><code>height</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">Number of rows to display (default = ALL)</td>
</tr>
<tr>
<td class="name"><code>width</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">Number of cols to display (default = ALL)</td>
</tr>
<tr>
<td class="name"><code>scale</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">Scale of display (default inherited from @Simulation class)</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line3229">line 3229</a>
</li></ul></dd>
</dl>
<h4 class="name" id="createDisplay_continuous"><span class="type-signature"></span>createDisplay_continuous<span class="signature">(config, name, property, customlab, height, width, scale, minval, maxval, nticks, decimals, num_colours, fill)</span><span class="type-signature"></span></h4>
<div class="description">
Create a display for a gridmodel, showing a certain property on it.
</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>config</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Object with the keys name, property, label, width, height, scale, minval, maxval, nticks, decimals, num_colours, fill
These keys:value pairs are:</td>
</tr>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The name of the model to display</td>
</tr>
<tr>
<td class="name"><code>property</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The name of the property to display</td>
</tr>
<tr>
<td class="name"><code>customlab</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Overwrite the display name with something more descriptive</td>
</tr>
<tr>
<td class="name"><code>height</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">Number of rows to display (default = ALL)</td>
</tr>
<tr>
<td class="name"><code>width</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">Number of cols to display (default = ALL)</td>
</tr>
<tr>
<td class="name"><code>scale</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">Scale of display (default inherited from @Simulation class)</td>
</tr>
<tr>
<td class="name"><code>minval</code></td>
<td class="type">
<span class="param-type">numeric</span>
</td>
<td class="description last">colour scale is capped off below this value</td>
</tr>
<tr>
<td class="name"><code>maxval</code></td>
<td class="type">
<span class="param-type">numeric</span>
</td>
<td class="description last">colour scale is capped off above this value</td>
</tr>
<tr>
<td class="name"><code>nticks</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">how many ticks</td>
</tr>
<tr>
<td class="name"><code>decimals</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">how many decimals for tick labels</td>
</tr>
<tr>
<td class="name"><code>num_colours</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">how many steps in the colour gradient</td>
</tr>
<tr>
<td class="name"><code>fill</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">type of gradient to use (viridis, inferno, red, green, blue)</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line3470">line 3470</a>
</li></ul></dd>
</dl>
<h4 class="name" id="createDisplay_discrete"><span class="type-signature"></span>createDisplay_discrete<span class="signature">(config, name, property, customlab, height, width, scale, minval, maxval, nticks, decimals, num_colours, fill)</span><span class="type-signature"></span></h4>
<div class="description">
Create a display for a gridmodel, showing a certain property on it.
</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>config</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">Object with the keys name, property, label, width, height, scale, minval, maxval, nticks, decimals, num_colours, fill
These keys:value pairs are:</td>
</tr>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The name of the model to display</td>
</tr>
<tr>
<td class="name"><code>property</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The name of the property to display</td>
</tr>
<tr>
<td class="name"><code>customlab</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Overwrite the display name with something more descriptive</td>
</tr>
<tr>
<td class="name"><code>height</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">Number of rows to display (default = ALL)</td>
</tr>
<tr>
<td class="name"><code>width</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">Number of cols to display (default = ALL)</td>
</tr>
<tr>
<td class="name"><code>scale</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">Scale of display (default inherited from @Simulation class)</td>
</tr>
<tr>
<td class="name"><code>minval</code></td>
<td class="type">
<span class="param-type">numeric</span>
</td>
<td class="description last">colour scale is capped off below this value</td>
</tr>
<tr>
<td class="name"><code>maxval</code></td>
<td class="type">
<span class="param-type">numeric</span>
</td>
<td class="description last">colour scale is capped off above this value</td>
</tr>
<tr>
<td class="name"><code>nticks</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">how many ticks</td>
</tr>
<tr>
<td class="name"><code>decimals</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">how many decimals for tick labels</td>
</tr>
<tr>
<td class="name"><code>num_colours</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last">how many steps in the colour gradient</td>
</tr>
<tr>
<td class="name"><code>fill</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">type of gradient to use (viridis, inferno, red, green, blue)</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line3397">line 3397</a>
</li></ul></dd>
</dl>
<h4 class="name" id="createFlockDisplay"><span class="type-signature"></span>createFlockDisplay<span class="signature">(name, config)</span><span class="type-signature"></span></h4>
<div class="description">
Create a display for a flockmodel, showing the boids
</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>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The name of an existing gridmodel to display</td>
</tr>
<tr>
<td class="name"><code>config</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">All the options for the flocking behaviour etc.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line3277">line 3277</a>
</li></ul></dd>
</dl>
<h4 class="name" id="display"><span class="type-signature"></span>display<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Display all the canvases linked to this simulation
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line3664">line 3664</a>
</li></ul></dd>
</dl>
<h4 class="name" id="events"><span class="type-signature"></span>events<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Apply global events to all grids in the model.
(only perfectmix currently... :D)
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line3654">line 3654</a>
</li></ul></dd>
</dl>
<h4 class="name" id="getCursorPosition"><span class="type-signature"></span>getCursorPosition<span class="signature">(canvas, event, scale)</span><span class="type-signature"></span></h4>
<div class="description">
Get the position of the cursor on the canvas
</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>canvas</code></td>
<td class="type">
<span class="param-type">canvas</span>
</td>
<td class="description last">A (constant) canvas object</td>
</tr>
<tr>
<td class="name"><code>event</code></td>
<td class="type">
<span class="param-type">event-handler</span>
</td>
<td class="description last">Event handler (mousedown)</td>
</tr>
<tr>
<td class="name"><code>scale</code></td>
<td class="type">
<span class="param-type">scale</span>
</td>
<td class="description last">The zoom (scale) of the grid to grab the correct grid point</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line3591">line 3591</a>
</li></ul></dd>
</dl>
<h4 class="name" id="initialGrid"><span class="type-signature"></span>initialGrid<span class="signature">({@GridModel}, property, value, fraction)</span><span class="type-signature"></span></h4>
<div class="description">
initialGrid populates a grid with states. The number of arguments
is flexible and defined the percentage of every state. For example,
initialGrid('grid','species',1,0.5,2,0.25) populates the grid with
two species (1 and 2), where species 1 occupies 50% of the grid, and
species 2 25%.
</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>{@GridModel}</code></td>
<td class="type">
</td>
<td class="description last">grid The gridmodel containing the grid to be modified.</td>
</tr>
<tr>
<td class="name"><code>property</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The name of the state to be set</td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>