aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tensorboard/components/vz_projector/scatterPlotVisualizer.ts
blob: 07ffd0b0116ef2874aafda317f88741d2f360f91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

import {RenderContext} from './renderContext';
import {DataSet} from './data';

/**
 * ScatterPlotVisualizer is an interface used by ScatterPlotContainer
 * to manage and aggregate any number of concurrent visualization behaviors.
 * To add a new visualization to the 3D scatter plot, create a new class that
 * implements this interface and attach it to the ScatterPlotContainer.
 */
export interface ScatterPlotVisualizer {
  /** Called to initialize the visualizer with the primary scene. */
  setScene(scene: THREE.Scene);
  /**
   * Called when the main scatter plot tears down the visualizer. Remove all
   * objects from the scene, and dispose any heavy resources.
   */
  dispose();
  /**
   * Called when the positions of the scatter plot points have changed.
   */
  onPointPositionsChanged(
      newWorldSpacePointPositions: Float32Array, dataSet: DataSet);
  /**
   * Called when the label accessor (functor that maps point ids to text labels)
   * changes. The label accessor is also part of RenderContext, but visualizers
   * may need it outside of a render call, to learn when it changes.
   */
  onSetLabelAccessor(labelAccessor: (index: number) => string);
  /**
   * Called immediately before the main scatter plot performs a picking
   * (selection) render. Set up render state for any geometry to use picking IDs
   * instead of visual colors.
   */
  onPickingRender(renderContext: RenderContext);
  /**
   * Called immediately before the main scatter plot performs a color (visual)
   * render. Set up render state, lights, etc here.
   */
  onRender(renderContext: RenderContext);
  /**
   * Called when the canvas size changes.
   */
  onResize(newWidth: number, newHeight: number);
}