JSDoc: Class: EmperorController

# Class: EmperorController

## EmperorController

EmperorController This is the application controller

The application controller, contains all the information on how the model is being presented to the user.

## Constructor

#### new EmperorController(dm, divId, webglcanvasopt) → {EmperorController}

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`dm` | DecompositionModel |  | An object that will be represented on screen.
`divId` | string |  | The element id where the controller should instantiate itself.
`webglcanvas` | node | <optional> | the canvas to use to render the information. This parameter is optional, and should rarely be set. But is useful for external applications like SAGE2.

Source:
  - controller.js, line 38

##### Returns:

Type
  EmperorController

### Members

#### $divId :node

jQuery object where the object lives in.

##### Type:

- node

Source:
  - controller.js, line 56

#### $plotMenu :node

Internal div where the plots live in (jQuery object).

##### Type:

- node

Source:
  - controller.js, line 88

#### $plotSpace :node

Internal div where the menus live in (jQuery object).

##### Type:

- node

Source:
  - controller.js, line 83

#### controllers :object

Holds a reference to all the tabs (view controllers) in the `$plotMenu`.

##### Type:

- object

Source:
  - controller.js, line 97

#### decViews :object

Object with all the available decomposition views.

FIXME: This is a hack to go around the fact that the constructor takes a single decomposition model instead of a dictionary

##### Type:

- object

Source:
  - controller.js, line 157

#### dm :DecompositionModel

Ordination data being plotted.

##### Type:

- DecompositionModel

Source:
  - controller.js, line 72

#### GRID_SCALE :float

Scaling constant for grid dimensions (read only).

##### Type:

- float

Source:
  - controller.js, line 45

#### height :float

Height of the object.

##### Type:

- float

Source:
  - controller.js, line 66

#### renderer :THREE.Renderer

Object in charge of doing the rendering of the scenes.

##### Type:

- THREE.Renderer

Source:
  - controller.js, line 111

#### rendererBackgroundColor :THREE.Color

Background color of the scene.

##### Type:

- THREE.Color

Default Value:
  - 0x00000000
Source:
  - controller.js, line 104

#### SCENE_VIEW_SCALE :float

Scaling constant for scene plot view dimensions

##### Type:

- float

Source:
  - controller.js, line 51

#### sceneViews :Array.<ScenePlotView3D>

List of the scene plots views being rendered.

##### Type:

- Array.<ScenePlotView3D>

Source:
  - controller.js, line 77

#### width :float

Width of the object.

##### Type:

- float

Source:
  - controller.js, line 61

### Methods

#### addTab(dvdict, viewConstructor)

Helper method to resize the plots.

##### Parameters:

Name | Type | Description
--- | --- | ---
`dvdict` | Array.<DecompositionView> | Dictionary of DecompositionViews.
`viewConstructor` | EmperorViewControllerABC | Constructor of the view controller.

Source:
  - controller.js, line 506

#### addView()

Helper method to add additional ScenePlotViews (i.e. another plot)

Source:
  - controller.js, line 181

#### loadConfig(json)

Load a settings file and set all controller variables.

This method will trigger a rendering callback.

##### Parameters:

Name | Type | Description
--- | --- | ---
`json` | object | Information about the emperor session to load.

Source:
  - controller.js, line 472

#### render()

Helper method to render sceneViews, gets called every time the browser indicates we can render a new frame, however it only triggers the appropriate rendering functions if something has changed since the last frame.

Source:
  - controller.js, line 296

#### resize(the, the)

Helper method to resize the plots

##### Parameters:

Name | Type | Description
--- | --- | ---
`the` | width | width of the entire plotting space
`the` | height | height of the entire plotting space

Source:
  - controller.js, line 202

#### saveConfig()

Write settings file for the current controller settings

The format is as follows: a javascript object with the camera position stored in the 'cameraPosition' key and the quaternion in the 'cameraQuaternion' key. Each controller in this.controllers is then saved by calling toJSON on them, and the resulting object saved under the same key as the controllers object.

Source:
  - controller.js, line 445

#### screenshot(typeopt)

Save the current canvas view to a new window

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`type` | string | <optional> | png | What format to save the file as.

Source:
  - controller.js, line 422