Skip to content
Sonia Zorba edited this page Nov 7, 2015 · 1 revision

Add custom objects

You can customize the map adding your custom objects (nebulas, star clusters, galaxies) on it.

To do this you can call the function addCustomObject(ra, dec, options) on a SkySphere instance.

The first two parameters of this function are RA (Right ascension) and Dec (Declination) of the object. RA is expressed in hours (from 0 to 24) and Dec is expressed in degree, from -90 to 90.

Notice that both are decimal numbers, so you have to convert values from their "standard form". So, for example, if RA is 15h29m18s the value to use is 15 + 29 / 60 + 18 / 3600 = 15.488333.

The third parameter is a JavaScript object containing custom object options.

Supported options are:

  • color: custom color in hexadecimal format (default is '#ff0000')
  • radius: radius in pixels (default is 2)
  • clickData: object that will be passed to the customOnClick function (defined in the SkySphere constructor) when clicking on the custom object.

Example:

sky.addCustomObject(3.58814, -4.92319, {
  clickData: 'Sun',
  color: '#ffe400',
  radius: 5
});

Center a custom object

Function addCustomObject return reference to the added object. It can be passed to the function centerSkyPoint to start an animation that center the object.

Example:

var m42 = sky.addCustomObject(5.58814, -4.92319, { clickData: 'M42' });
sky1.centerSkyPoint(m42);
Clone this wiki locally