Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SpaceObject

An object that can be added to a visualization.

example
const myObject = viz.addObject('planet1', {
  position: [0, 0, 0],
  scale: [1, 1, 1],
  particleSize: 5,
  labelText: 'My object',
  labelUrl: 'http://...',
  hideOrbit: false,
  ephem: new Spacekit.Ephem({...}),
  textureUrl: '/path/to/spriteTexture.png',
  basePath: '/base',
  ecliptic: {
    lineColor: 0xCCCCCC,
    displayLines: false,
  },
  theme: {
    color: 0xFFFFFF,
    orbitColor: 0x888888,
  },
});

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected _context

Private Optional _eclipticLines

_eclipticLines: Object3D

Protected _id

_id: string

Protected _initialized

_initialized: boolean

Private _isStaticObject

_isStaticObject: boolean

Private Optional _label

_label: HTMLElement

Private _lastLabelUpdate

_lastLabelUpdate: number

Private Optional _object3js

_object3js: Object3D

Protected _options

Private Optional _orbit

_orbit: Orbit

Private Optional _orbitAround

_orbitAround: SpaceObject

Private Optional _orbitPath

_orbitPath: Object3D

Private Optional _particleIndex

_particleIndex: number

Private _position

_position: Coordinate3d

Protected Optional _renderMethod

_renderMethod: "SPRITE" | "PARTICLESYSTEM" | "ROTATING_OBJECT" | "SPHERE"

Private _scale

_scale: [number, number, number]

Private _showLabel

_showLabel: boolean

Protected _simulation

_simulation: Simulation

Private _useEphemTable

_useEphemTable: boolean

Methods

Private createLabel

  • createLabel(): HTMLElement
  • Returns HTMLElement

    A div that contains the label for this object

Private createOrbit

Private createSprite

  • createSprite(): Sprite

get3jsObjects

  • get3jsObjects(): Object3D[]
  • Gets the THREE.js objects that represent this SpaceObject. The first object returned is the primary object. Other objects may be returned, such as rings, ellipses, etc.

    Returns Object3D[]

    A list of THREE.js objects

getBoundingObject

  • getBoundingObject(): Promise<Object3D>
  • Specifies the object that is used to compute the bounding box. By default, this will be the first THREE.js object in this class's list of objects.

    Returns Promise<Object3D>

    THREE.js object

getColor

  • getColor(): number
  • Gets the color of this object. Usually this corresponds to the color of the dot representing the object as well as its orbit.

    Returns number

    A hexidecimal color value, e.g. 0xFFFFFF

getId

  • getId(): string

getLabelVisibility

  • getLabelVisibility(): boolean
  • Gets label visilibity status.

    Returns boolean

    Whether label is visible.

getOrbit

  • getOrbit(): undefined | Orbit
  • Gets the {Orbit} object for this SpaceObject.

    Returns undefined | Orbit

    Orbit object

getPosition

  • Gets the visualization coordinates of this object at a given time.

    Parameters

    • jd: number

      JD date

    Returns Coordinate3d

    [X, Y,Z] coordinates

init

  • init(): boolean
  • Initializes label and three.js objects. Called automatically unless you've set autoInit to false in constructor (this init is suppressed by some child classes).

    Returns boolean

isReady

  • isReady(): boolean
  • Determines whether object is ready to be measured or added to scene.

    Returns boolean

    True if ready

isStaticObject

  • isStaticObject(): boolean
  • Determines whether object is static (can't change its position) or whether its position can be updated (ie, it has ephemeris)

    Returns boolean

    Whether this object can change its position.

orbitAround

  • Make this object orbit another orbit.

    Parameters

    • spaceObj: SpaceObject

      The SpaceObject that will serve as the origin of this object's orbit.

    Returns void

removalCleanup

  • removalCleanup(): void

Private renderObject

  • renderObject(): void

setLabelVisibility

  • setLabelVisibility(val: boolean): void
  • Toggle the visilibity of the label.

    Parameters

    • val: boolean

      Whether to show or hide.

    Returns void

setPosition

  • setPosition(x: number, y: number, z: number): void
  • Updates the position of this object. Applicable only if this object is a sprite and not a particle type.

    Parameters

    • x: number

      X position

    • y: number

      Y position

    • z: number

      Z position

    Returns void

Protected setPositionedObject

  • setPositionedObject(obj: Object3D): void

Private shouldUpdateObjectPosition

  • shouldUpdateObjectPosition(afterJd: number): boolean
  • Parameters

    • afterJd: number

      Next JD

    Returns boolean

    Whether to update

update

  • update(jd: number, force?: boolean): void
  • Updates the object and its label positions for a given time.

    Parameters

    • jd: number

      JD date

    • force: boolean = false

      Whether to force an update regardless of checks for movement.

    Returns void

Private updateLabelPosition

Generated using TypeDoc