Class: CGObject

CGObject

The CGObject is the base class of many CGView Classes. In particular, any class that is drawn on the map will be a subclass of CGObject (e.g. Track, Slot, Feature, Plot, etc).

Any subclass instances will be given a unique temporary cgvID. This id is not saved to JSON and should not be used across CGView sessions (i.e. don't expect a feature to have the same cgvID if it's loaded in the viewer again). Any object can be easily returned using the cgvID and Viewer.objects.

Classes that extend CGObject will have access to several commonly accessed viewer objects:

  • viewer
  • sequence
  • canvas
  • layout

Attributes

Attribute Type Description
visible Boolean Object is visible [Default: true]
meta Object Meta data [Default: {}]

new CGObject(viewer, options, meta)

Create a new CGObject.

Name Type Description
viewer Viewer

The viewer

options Object

Attributes used to create the bookmark

meta Object optional

User-defined Meta data to add to the bookmark.

Members

canvasCanvas

Get the canvas.

layoutLayout

Get the layout.

metaBoolean

Get or Set the meta data of this object. See the meta data tutorial for details.

sequenceSequence

Get the sequence.

viewerViewer

Get the viewer.

visibleBoolean

Get or Set the visibility of this object.

Methods

addPluginOptions(id, options)

Add a plugin to the object.

Name Type Description
id String

The id of the plugin

options Object

The plugin options

deleteFromObjects()

Remove the object from Viewer.objects

hasPlugin(pluginID){Boolean}

Does this object have a particular plugin?

Name Type Description
pluginID String

The ID of the plugin

Returns:
Type Description
Boolean
  • Whether the object has the plugin

optionsForPlugin(pluginName){Object}

Get the options for a particular plugin.

Name Type Description
pluginName String

The name of the plugin

Returns:
Type Description
Object
  • The options for the plugin or undefined if the plugin is not found

toString(){String}

Return the class name as a string.

Returns:
Type Description
String
  • 'CGObject'

updatePluginOptions(id, options)

Update plugin options. Merge the new options with the old options.

Name Type Description
id String

The id of the plugin

options Object

The plugin options