Skip to main content

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', dracoScriptsUrl: 'libs/draco/', ambientLight: { color: 'white', intencity: 2.5 }, }); plugin.addModels([ { modelId: '03a234cb', coordinates: [82.886554, 54.980988], modelUrl: 'models/cube_draco.glb', rotateX: 90, scale: 1000, }, ]); ```
Parameters
map
Map<>
The map instance
pluginOptions?
GltfPlugin initialization options
Returns
GltfPlugin<>
Methods
addModel(modelOptions)
Add model to the map
Parameters
modelOptions
The models' options
Returns
Promise<void>
addModels(modelOptions)
Add the list of models to the map Use this method if you want to add a list of models to the map at the same time
Parameters
modelOptions
ModelOptions[]
An array of models' options
Returns
Promise<void>
addModelsPartially(modelOptions, ids)
Add the list of models to the map partially Use this method if you want to add to the map some models from the list of models and want to preserve remaining ones in the cache without adding them to the map
Parameters
modelOptions
ModelOptions[]
An array of models' options
ids
Id[]
An array of identifiers of the models that must be added to the scene
Returns
Promise<void>
addPoiGroup(options, state?)
Add the group of poi to the map
Parameters
options
Options of the group of poi to add to the map
state?
State of the active building to connect with added the group of poi
Returns
Promise<void>
addRealtyScene(scene, state?)
Add the interactive realty scene to the map
Parameters
scene
BuildingOptions[]
The options of the scene to add to the map
state?
State of the active building to connect with added scene
Returns
Promise<void>
removeModel(id, preserveCache?)
Remove the model from the map and cache or from the map only
Parameters
id
Identifier of the model to delete
preserveCache?
boolean
Flag to keep the model in the cache
Returns
void
removeModels(ids, preserveCache?)
Remove models from the map and cache or from the map only
Parameters
ids
Id[]
preserveCache?
boolean
Flag to keep the model in the cache
Returns
Promise<void>
removePoiGroup(id)
Remove the group of poi from the map
Parameters
id
Identifier of the group of poi to remove
Returns
void
removeRealtyScene(preserveCache?)
Remove interactive realty scene from the map
Parameters
preserveCache?
boolean
Flag to keep the model in the cache
Returns
void
setOptions(pluginOptions)
Parameters
pluginOptions
Pick<Required<PluginOptions>, "groundCoveringColor">
Returns
void