new Mizar(options)
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Mizar.inputParameters | Configuration for Mizar |
Members
-
AnimationFactory
-
Creates an animation
-
ServiceFactory
-
Creates a service
-
ProviderFactory
-
Creates a provider
-
VERSION
-
Static variable, API version.
SemVer concept is used for versioning -
ANIMATION
-
Static variable, supported animation type
-
LAYER
-
Static variable, supported layer type
-
GEOMETRY
-
Static variable, supported geometry type
-
NAVIGATION
-
Static variable, supported navigation type
-
CONTEXT
-
Static variable, supported context type
-
PROJECTION
-
Static variable, supported projection type
-
CRS
-
Static variable, supported coordinate reference system type
-
SERVICE
-
Static variable, supported service type
-
UTILITY
-
Static variable, supported utility type
-
PROVIDER
-
Static variable, supported provider type
Methods
-
getSkyContext()
-
Returns the sky context.
Returns:
- Type
- SkyContext | null
-
getPlanetContext()
-
Returns the planet context.
Returns:
- Type
- PlanetContext | null
-
getActivatedContext()
-
Returns the selected context
Returns:
- Type
- PlanetContext | SkyContext
-
setActivatedContext(contextMode)
-
Selects the context as default context according to the context mode.
Once a context is selected, methods can be applied to it.Parameters:
Name Type Description contextModeCONTEXT select one context among context Fires:
- Mizar#mizarMode:toggle
Throws:
-
contextMode not valid - a valid contextMode is included in the list CONTEXT
- Type
- RangeError
-
getRenderContext()
-
Returns the rendering context.
Returns:
the rendering context- Type
- RenderContext
-
getOptions()
-
Returns the options
Returns:
- Mizar's options- Type
- Mizar.parameters
-
getCrs()
-
Returns the coordinate reference system related to the selected context
Returns:
the coordinate reference system- Type
- Crs
-
setCrs(coordinateSystem)
-
Sets the coordinate reference system related to the selected context
Parameters:
Name Type Description coordinateSystemAbstractProjection.configuration | AbstractProjection.azimuth_configuration | AbstractProjection.mercator_configuration coordinate system description -
createContext(contextMode, options)
-
Creates a context according to the context mode.
The created context is selected automatically as default context. The rendering context for the new context is retrieved from the previous context.Parameters:
Name Type Description contextModeCONTEXT Select on context among context optionsAbstractContext.skyContext | AbstractContext.planetContext Options for the context, See options.planetContext or options.skycontext configuration for Mizar Fires:
- Mizar#mizarMode:toggle
Throws:
-
contextMode not valid - a valid contextMode is included in the list CONTEXT
- Type
- RangeError
-
toggleDimension()
-
Switches 2D <--> 3D, only for planetary context.
When this method is used in a sky context, and exception is thrownThrows:
"Not implemented" - Will throw an exception for Sky mode. In this version, the sky cannot be projected in 2D -
toggleContext(gwLayer, options, callback)
-
Switches planetary <---> sky context
Parameters:
Name Type Description gwLayerPlanetLayer planet layer optionsAbstractContext.planetContext options for the planet callbacktoggleContextCallback Call at the end of the toggle Fires:
- Mizar#mizarMode:toggle
-
getSkyLayers()
-
Returns the sky layers, which have been added by Mizar#addLayer.
Returns:
the layers- Type
- Array.<Layer>
-
getPlanetLayers()
-
Returns the planet layers, which have been added by Mizar#addLayer
Returns:
the layers- Type
- Array.<Layer>
-
getLayers(mode)
-
Returns the layers for a specific context.
When no context is specified, the layers from the selected context are returned.Parameters:
Name Type Description modeCONTEXT | undefined Context on which the function is applied Throws:
-
Will throw an error when the mode is not part of CONTEXT
- Type
- RangeError
Returns:
the layers- Type
- Array.<Layer>
-
-
getAllLayers()
-
Returns all the layers regardless of the context.
Returns:
the layers- Type
- Array.<Layer>
-
getLayerByID(layerID, mode)
-
Returns the layer by its ID according to the context.
When no context is specified, the layer from the selected context is returned.
The ID is a unique layer identifier, which is returned when the layer description is added to MizarParameters:
Name Type Description layerIDLayer's ID modeCONTEXT | undefined Context on which the function is applied Returns:
The layer or undefined when the layer is not found- Type
- Layer | undefined
-
getLayerByName(layerName, mode)
-
Returns the layer by its name according to the context.
When no context is specified, the layer from the selected context is returned.
Note: The name may not be unique. In this case, the first layer having this name is returnedParameters:
Name Type Description layerNamestring Layer's name, provided in the layer description when the layer is added modeCONTEXT | undefined Context on which the function is applied Throws:
-
Will throw an error when the mode is not part of CONTEXT
- Type
- RangeError
Returns:
the layer or undefined when the layer is not found- Type
- Layer | undefined
-
-
addLayer(layerDescription [, layerPlanet])
-
Adds a layer according to the selected context.
When layerPlanet is not provided, then the layer is added to the selected context otherwise the layer is added to the layerPlanet.Parameters:
Name Type Argument Description layerDescriptionObject See the base properties AbstractLayer.configuration and a specific layer for specific properties layerPlanetPlanetLayer <optional>
the planet with which the layer must be linked - See:
-
- AtmosphereLayer : A layer to create an atmosphere on a planet.
- BingLayer: The Microsoft service proving a WMTS server.
- CoordinateGridLayer : A layer to create a grid on the sky
- GeoJSONLayer : A layer to add a GeoJSON on the globe
- GroundOverlayLayer : A layer to draw an image overlay draped onto the terrain
- HipsCatLayer : A layer to draw a HIPS catalogue
- HipsFitsLayer : A layer to draw an Hips Fits
- HipsGraphicLayer : A layer to draw a Hips JPEG/PNG
- MocLayer : A layer to draw a multi-order-coverage index
- OpenSearchLayer : A layer to draw the result from an open search service
- OSMLayer : A layer to display data coming from OpenStreetMap server
- PlanetLayer : A layer to save all layers of a planet
- TileWireframeLayer : A layer to draw a grid on the planet
- VectorLayer : A layer to draw a vector
- WCSElevationLayer : A layer to draw the elevation
- WMSElevationLayer : A layer to draw the elevation
- WMSLayer : A layer to draw images coming from the WMS server
- WMTSLayer : A layer to draw predefined tiles coming from a WMTS server
- Mizar#setActivatedContext
- Mizar#createContext
- To Do:
-
- Bug to fix : PlanetLayer should use this function to create layer when the context changes
Listens to Events:
- AbstractLayer#visibility:changed
Returns:
a unique identifier- Type
- string
-
removeLayer(layerID, mode)
-
Removes a layer by its ID according to the context.
When no context is specified, then the function is applied on the selected context.Parameters:
Name Type Description layerIDstring Layer's ID modeCONTEXT | undefined Context on which the function is applied Throws:
-
Will throw an error when the mode is not part of CONTEXT
- Type
- RangeError
Returns:
True when the layer is added otherwise False- Type
- boolean
-
-
setBackgroundLayer(layerName, mode)
-
Sets the background layer according to the selected context.
When no context is specified, then the function is applied on the selected context.
Note 1: The name is not a unique identifier. The first layer matching at this name is returned
Note 2: The layer must be added beforeParameters:
Name Type Description layerNamestring Layer's name, which has been provided in the layer description modeCONTEXT | undefined Context on which the function is applied Throws:
-
Will throw an error when the mode is not part of CONTEXT
- Type
- RangeError
Returns:
True when the layer is set as background otherwise False- Type
- boolean
-
-
setBackgroundLayerByID(layerID, mode)
-
Sets the background layer by ID according to the context.
When no context is specified, then the function is applied on the selected context. Note: The layer must be added beforeParameters:
Name Type Description layerIDstring Unique layer identifier. modeCONTEXT | undefined Context on which the function is applied. Throws:
-
Will throw an error when the mode is not part of CONTEXT
- Type
- RangeError
Returns:
True when the layer is set as background otherwise False- Type
- boolean
-
-
setBaseElevation(layerName, mode)
-
Sets the base elevation by its layer's name according to the context.
When no context is specified, then the function is applied on the selected context. Note: The layer must be added beforeParameters:
Name Type Description layerNamestring Name of the layer modeCONTEXT | undefined Context on which the function is applied Throws:
-
Will throw an error when the mode is not part of CONTEXT
- Type
- RangeError
Returns:
True when the base elevation is set otherwise false- Type
- boolean
-
-
searchOnLayerDescription(query, mode)
-
Looks through each value in the list according to the context, returning an array of all the values that match the query.
The query is performed on the name and the description of each layer.
When no context is specified, the function is applied on the selected context.Parameters:
Name Type Description querystring query on the layer'name or description modeCONTEXT | undefined Context on which the query is run. Returns:
- Type
- Array.<Layer>
-
searchSkyLayer(query)
-
Looks through each value in the sky layers, returning an array of all the values that match the query.
The query is performed on the name and the description of each layerParameters:
Name Type Description querystring query on the layer'name or description Returns:
An array of layers matching the constraint- Type
- Array.<Layer>
-
searchPlanetLayer(query)
-
Looks through each value in the planets layers, returning an array of all the values that match the query.
The query is performed on the name and the description of each layerParameters:
Name Type Description querystring query on the layer'name or description Returns:
An array of layers matching the constraint- Type
- Array.<Layer>
-
registerNoStandardDataProvider(type, loadFunc, mode)
-
Registers no standard data provider in a predefined context.
When no context is specified, the function is applied to the selected context.Parameters:
Name Type Description typestring data provider key loadFuncfunction Function to convert the data modeCONTEXT | undefined Context Throws:
-
Will throw an error when the mode is not part of CONTEXT
- Type
- RangeError
Example
Registers planets on the sky
var planetProvider = ProviderFactory.create(Mizar.PROVIDER.Planet); this.registerNoStandardDataProvider("planets", planetProvider.loadFiles); -
-
createStats(options)
-
Creates and get Stats Object
Parameters:
Name Type Description optionsObject Configuration properties for stats. See Stats for options Returns:
- Type
- Stats
-
render()
-
Renders the canvas.
-
dispose()
-
Disposes the Mizar's contexts (planet and sky)
-
destroy()
-
Destroys Mizar
Type Definitions
-
inputParameters
-
Input Mizar parameters
Type:
- Object
Properties:
Name Type Argument Description canvasObject | string div ID or div element configurationMizar.inputConfiguration <optional>
Mizar global configuration skyContextAbstractContext.skyContext <optional>
Sky context configuration planetContextAbstractContext.planetContext <optional>
Planet context configuration -
parameters
-
Mizar parameters
Type:
- Object
Properties:
Name Type Argument Description canvasObject | string div ID or div element configurationMizar.configuration <optional>
Mizar global configuration skyContextAbstractContext.skyContext <optional>
Sky context configuration planetContextAbstractContext.planetContext <optional>
Planet context configuration -
inputConfiguration
-
Mizar configuration
Type:
- Object
Properties:
Name Type Argument Default Description mizarBaseUrlstring <optional>
Used to access to MizarWidget resources debugboolean <optional>
false Debug mode isMobileboolean <optional>
false Mobile support positionTrackerAbstractTracker.position_configuration <optional>
Position tracker configuration elevationTrackerAbstractTracker.elevation_configuration <optional>
Elevation tracker configuration registryObject <optional>
Hips service registry Properties
Name Type Description hipsstring Hips Registry -
configuration
-
Mizar configuration
Type:
Properties:
Name Type Description mizarAPIUrlstring URL of this script, used to reference shaders and CSS of Mizar API
Documentation