Catalog

Catalog

new Catalog(options)

Description:
  • Represents a catalog with configurable options for display and interaction.
Source:
Example
const catalogOptions = {
  url: "https://example.com/catalog",
  name: "My Catalog",
  color: "#ff0000",
  sourceSize: 10,
  markerSize: 15,
  shape: "circle",
  limit: 1000,
  onClick: (source) => {
     // handle sources
  },
  readOnly: true,
  raField: "ra",
  decField: "dec",
  filter: (source) => source.mag < 15,
  selectionColor: "#00ff00",
  hoverColor: "#ff00ff",
  displayLabel: true,
  labelColor: "#00ff00",
  labelFont: "12px Arial"
};
const myCatalog = new Catalog(catalogOptions);
Parameters:
Name Type Description
options CatalogOptions Configuration options for the catalog.

Members

removeAll

Description:
  • Clear all the sources from the catalog
Source:
Clear all the sources from the catalog

Methods

addSources(sources)

Description:
  • Add sources to the catalog
Source:
Parameters:
Name Type Description
sources Array.<Source> An array of sources or only one source to add

addSourcesAsArray(columnNames, array)

Description:
  • Create sources from a 2d array and add them to the catalog
Source:
Parameters:
Name Type Description
columnNames Array.<String> array with names of the columns
array Array.<Array.<String>> | Array.<Array.<number>> 2D-array, each item being a 1d-array with the same number of items as columnNames

deselectAll()

Description:
  • Unselect all the source of the catalog
Source:

getSource(idx) → {Source}

Description:
  • Get one source by its index in the catalog
Source:
Parameters:
Name Type Description
idx number the index of the source in the catalog sources
Returns:
- the source at the index
Type
Source

getSourceSize() → {number}

Description:
  • Get the size of the catalog sources
Source:
Returns:
- the size of the sources
Type
number

getSources() → {Array.<Source>}

Description:
  • Get all the sources
Source:
Returns:
- an array of all the sources in the catalog object
Type
Array.<Source>

hide()

Description:
  • Hide the catalog
Source:

remove(source)

Description:
  • Remove a specific source from the catalog
Source:
Parameters:
Name Type Description
source Source the source to remove

selectAll()

Description:
  • Select all the source catalog
Source:

setColor(color)

Description:
  • Set the color of the catalog
Source:
Parameters:
Name Type Description
color String the new color

setHoverColor(color)

Description:
  • Set the color of hovered sources
Source:
Parameters:
Name Type Description
color String the new color

setSelectionColor(color)

Description:
  • Set the color of selected sources
Source:
Parameters:
Name Type Description
color String the new color

setShape(shapeopt)

Description:
  • Set the shape of the catalog sources
Source:
Parameters:
Name Type Attributes Default Description
shape string | function | HTMLImageCanvas | HTMLImageElement <optional>
"square" the type of the shape. Can be square, rhomb, plus, cross, triangle, circle. A callback function can also be called that return an HTMLImageElement in function of the source object. A canvas or an image can also be given.

setSourceSize(sourceSize)

Description:
  • Set the size of the catalog sources
Source:
Parameters:
Name Type Description
sourceSize number the new size

show()

Description:
  • Show the catalog
Source:

updateShape(optionsopt)

Description:
  • Set the shape of the sources
Source:
Parameters:
Name Type Attributes Description
options Object <optional>
shape options
Properties
Name Type Attributes Default Description
color string <optional>
the color of the shape
selectionColor string <optional>
the color of the shape when selected
sourceSize number <optional>
size of the shape
hoverColor string <optional>
options.color the color to apply to sources in the catalog when they are hovered.
shape string | function | HTMLImageCanvas | HTMLImageElement <optional>
"square" the type of the shape. Can be square, rhomb, plus, cross, triangle, circle. A callback function can also be called that return an HTMLImageElement in function of the source object. A canvas or an image can also be given.
onClick string | function <optional>
Whether the source data appears as a table row or a in popup. Can be 'showTable' string, 'showPopup' string or a custom user defined function that handles the click.