py3dtiles.tileset.extension.base_extension module

class py3dtiles.tileset.extension.base_extension.BaseExtension(name: str)[source]

Bases: object

A base class to manage 3dtiles extension.

If an extension is added somewhere in a tileset, the user must add the name of the extension in the attribute extensions_used of the class TileSet. Also, if the support of an extension is necessary to display the tileset, the name must be added in the attribute extensions_required of the class TileSet.

classmethod from_dict(extension_dict: dict[str, Any]) BaseExtension[source]

Creates an instance of the default extension class BaseExtension. This instance will store all attributes in a single field.

Parameters:

extension_dict – a dict containing all attributes of the extension (keys and values).

Returns:

a BaseExtension instance.

to_dict() dict[str, Any][source]
Returns:

a dict containing all attributes of the extension (keys and values).

py3dtiles.tileset.extension.base_extension.create_extension(extension_key: str, extension_dict: dict[str, Any]) BaseExtension[source]

Creates an instance of the extension if it is registered. Else, creates an instance of BaseExtension storing all attributes in a single field.

Parameters:
  • extension_key – the name of the extension to create

  • extension_dict – a dict containing all attributes of the extension (keys and values).

Returns:

an extension.

py3dtiles.tileset.extension.base_extension.is_extension_registered(extension_key: str) bool[source]

Checks if the extension is registered.

Parameters:

extension_key – the name of the extension as a string.

Returns:

a boolean.

py3dtiles.tileset.extension.base_extension.register_extension(extension_key: str, extension_class: type[BaseExtension]) None[source]

Registers an extension by mapping the name of the extension with the corresponding class.

Parameters:
  • extension_key – the name of the extension as a string.

  • extension_class – the class of the extension.