Class: PatchManager

PatchManager()

new PatchManager()

Class to manage patches and all their cohorts
Source:

Methods

addData(data)

Add patch data
Parameters:
Name Type Description
data Object Cohort data
Source:

addYearData(data)

Add data common for all patches and cohorts during given year
Parameters:
Name Type Description
data *
Source:

calcPatchesCentre() → {THREE.Vector3}

Calculate the centre of mass for the patches
Source:
Returns:
Centre of mass position
Type
THREE.Vector3

drawCohortInfo()

Updates the cohort info window depending on what cohort (if any) is currently selected
Source:

drawSmoothTerrain(slices, stacks) → {Object}

Function for creating the interpolated, smooth terrain mesh
Parameters:
Name Type Default Description
slices number 20 Number of length-wise divisions for the parametric geometry
stacks number 20 Number of width-wise divisions for the parametric geometry
Source:
Returns:
Type
Object

getCohortById(cohortId) → {Cohort}

Find the cohort that matches the given cohort ID
Parameters:
Name Type Description
cohortId number
Source:
Returns:
cohort
Type
Cohort

getSelectedCohortData()

Convenience function to get the data for the currently selected cohort
Source:
Returns:
data

initVis(year)

Initialise the visualisation. Only needs to be run once, but needs to know the year to initialise the tree positions
Parameters:
Name Type Description
year * Year to initialise on (usually the first year in the simulation)
Source:

nextYear()

Go to the next year of the trajectory, skipping years that we do not have data for.
Source:

prevYear()

Go to the previous year of the trajectory, skipping years that we do not have data for.
Source:

selectCohort(cohortId)

Select cohort by cohortID
Parameters:
Name Type Description
cohortId number
Source:

setYear(year)

Sets the current year and redraws all cohorts
Parameters:
Name Type Description
year number Year to set
Source:

updateMargins(patchMargins)

Updates the distance between patches
Parameters:
Name Type Description
patchMargins number A factor to distance patches from each other. A value of 1 means no margin. A value of 1.2 means 20% margin.
Source: