Reference Source
public class | source

ZonesPlugin

Extends:

Plugin → ZonesPlugin

ZonesPlugin documentation to be added, mostly compatible with DistanceMeasurementsPlugin.

Constructor Summary

Public Constructor
public

constructor(viewer: Viewer, cfg: Object)

Member Summary

Public Members
public
public

zIndex: *

public get

zones: {String: Zone}

Gets the existing Zones, each mapped to its Zone#id.

Method Summary

Public Methods
public

createZone(params: Object): Zone

Creates a Zone.

public

Destroys this ZonesPlugin.

Inherited Summary

From class Plugin
public

ID for this Plugin, unique within its Viewer.

public

viewer: Viewer

The Viewer that contains this Plugin.

public

Destroys this Plugin and removes it from its Viewer.

public

error(msg: String)

Logs an error message to the JavaScript developer console, prefixed with the ID of this Plugin.

public

fire(event: String, value: Object, forget: Boolean)

Fires an event on this Plugin.

public

Returns true if there are any subscribers to the given event on this Plugin.

public

log(msg: String)

Logs a message to the JavaScript developer console, prefixed with the ID of this Plugin.

public

off(subId: String)

Cancels an event subscription that was previously made with Plugin#on or Plugin#once.

public

on(event: String, callback: Function, scope: Object): String

Subscribes to an event on this Plugin.

public

once(event: String, callback: Function, scope: Object)

Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd.

public

scheduleTask(task: *)

Schedule a task to perform on the next browser interval

public

warn(msg: String)

Logs a warning message to the JavaScript developer console, prefixed with the ID of this Plugin.

Public Constructors

public constructor(viewer: Viewer, cfg: Object) source

Creates this Plugin and installs it into the given Viewer.

Override:

Plugin#constructor

Params:

NameTypeAttributeDescription
viewer Viewer

The Viewer.

cfg Object
  • optional

Plugin configuration.

cfg.id String
  • optional
  • default: "Zones"

Optional ID for this plugin, so that we can find it within Viewer#plugins.

cfg.container HTMLElement
  • optional

Container DOM element for markers and labels. Defaults to document.body.

cfg.defaultColor string
  • optional
  • default: #00BBFF

The default color of the length dots, wire and label.

cfg.zIndex number
  • optional

If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).

cfg.pointerLens PointerCircle
  • optional

A PointerLens to help the user position the pointer. This can be shared with other plugins.

Public Members

public defaultColor: * source

public zIndex: * source

public get zones: {String: Zone} source

Gets the existing Zones, each mapped to its Zone#id.

Public Methods

public createZone(params: Object): Zone source

Creates a Zone.

The Zone is then registered by Zone#id in ZonesPlugin#zones.

Params:

NameTypeAttributeDescription
params Object

Zone configuration.

params.id String

Unique ID to assign to Zone#id. The Zone will be registered by this in ZonesPlugin#zones and Scene.components. Must be unique among all components in the Viewer.

params.origin.worldPos Number[]

Origin World-space 3D position.

params.origin.entity Entity

Origin Entity.

params.target.worldPos Number[]

Target World-space 3D position.

params.target.entity Entity

Target Entity.

params.color string
  • optional

The color of the length dot, wire and label.

Return:

Zone

The new Zone.

public destroy() source

Destroys this ZonesPlugin.

Destroys all Zones first.

Override:

Plugin#destroy