class
GltfPlugin
Event emitter.
Extends: Evented<GltfPluginEventTable>
new constructor
(map, pluginOptions?)
The main class of the plugin.
Example:
```js
const plugin = new GltfPlugin(map, {
modelsLoadStrategy: 'waitAll',
modelsBaseUrl: 'https://url_to_models',
});
plugin.addModels([
{
modelId: '03a234cb',
coordinates: [82.886554, 54.980988],
modelUrl: 'models/cube_draco.glb',
rotateZ: 90,
scale: 2,
},
]);
```
Parameters
map
Map<>
The map instance.
pluginOptions?
GltfPlugin initialization options.
Returns
GltfPlugin<>
Methods
addLabelGroup
(options, state?)
Adds a group of labels to the map.
Parameters
options
Options of the group of labels.
state?
A state of active building and floor a group of labels is associated with.
Returns
void
addModel
(modelToLoad, hideOnLoad)
Adds a model to the map.
Parameters
modelToLoad
Options of a model.
hideOnLoad
boolean
Set to
`true`
if a model should be hidden on loading completion.
Returns
Promise<void>
addModels
(modelsToLoad, modelIdsToShow?)
Adds a list of models to the map.
Parameters
modelsToLoad
ModelOptions[]
An array of options of models.
modelIdsToShow?
string[]
An array of ids of models that should be shown. If it's not provided
all models will be shown.
Returns
Promise<void>
addRealtyScene
(scene, state?)
Adds an interactive realty scene to the map.
Parameters
scene
BuildingOptions[]
Options of the scene to add to the map.
state?
A state of building and floor that should be active on realty scene initialization.
Returns
Promise<void>
destroy
Destroys the plugin.
Returns
void
getModelStatus
(id)
Returns a current status of a model.
There can be no model or it can be loading or loaded.
Parameters
hideModel
(id)
Hides a model on the map.
Parameters
id
string
A model id.
Returns
void
hideModels
(ids)
Hides models on the map.
Parameters
ids
string[]
Returns
void
hideRealtyScene
Hides a shown realty scene on the map.
Returns
void
removeLabelGroup
(id)
Removes a group of labels from the map.
Parameters
id
string
A label group id.
Returns
void
removeModel
(id, keepModel?)
Removes a model from the map.
Parameters
id
string
A model id.
keepModel?
boolean
Specifies whether model data should be cached for future use.
Returns
void
removeModels
(ids, keepModels?)
Removes models from the map.
Parameters
ids
string[]
keepModels?
boolean
Specifies whether model data should be cached for future use.
Returns
void
removeRealtyScene
(keepModels?)
Removes an interactive realty scene from the map.
Parameters
keepModels?
boolean
Specifies whether model data should be cached for future use.
Returns
void
setOptions
(pluginOptions)
Sets options of the plugin.
Parameters
pluginOptions
Pick<Required<PluginOptions>, "groundCoveringColor">
Plugin options that are available for setting.
Returns
void
showModel
(id)
Shows a model on the map.
Parameters
id
string
A model id.
Returns
void
showModels
(ids)
Shows models on the map.
Parameters
ids
string[]
Returns
void
showRealtyScene
Shows a hidden realty scene on the map.
Returns
void