API (v2.0.0) - Giro3D
    Preparing search index...

    An entity that can display spherical panoramas in an equirectangular projection.

    The panoramic image is mapped into a sphere using in the equirectangular projection.

    The units are the degrees. This is the same projection that is used for the EPSG:4326 coordinate system.

    In this projection:

    • the center of the image is at [0, 0]
    • the top left corner is at [-180, +90],
    • the top right corner is at [+180, +90],
    • the bottom right corner is at [+180, -90],
    • the bottom left corner is at [-180, -90],

    This special coordinate system is used for layers that are added to this entity. It is technically equivalent to the EPSG:4326 system, but since the images projected into the sphere are not georeferenced in an actual cartographic coordinate system, we use this special CRS.

    All image sources must express extents in this coordinate system.

    This entity is a subclass of Map. To load a panoramic images, you must add it as a core.layer.ColorLayer | ColorLayer with addLayer.

    • For simple images, such as JPG, PNG and WebP, use a sources.StaticImageSource | StaticImageSource. Note that the image dimensions cannot exceed WebGL's MAX_TEXTURE_SIZE (4096 pixels), and that the extent of this source must be expressed in the 'equirectangular'CRS (see note below).

    • For images that exceed WebGL's MAX_TEXTURE_SIZE, you can convert them to GeoTIFF / COG with GDAL, in the EPSG:4326 coordinate system and appropriate georeferencing parameters (i.e if the image uses the entire equirectangular projection, its extent would be -180, -90, +180, +90), then load it through a sources.GeoTIFFSource | GeoTIFFSource. It will be streamed efficiently to save memory and HTTP bandwidth. Again, the CRS of this source must be 'equirectangular'.

    • You can also load arbitrary vector features in the 'equirectangular' coordinate system using a sources.VectorSource | VectorSource, and they will be positioned accordingly on the surface of the sphere. This can be used for example to digitize geometries from features visible in the panoramic image. If the features are already expressed in the equirectangular projection, no need to mention it in the constructor of the source.

    Panoramic images generally have an orientation expressed in heading, pitch and roll (typically in degrees).

    Use the setOrientation method to set the orientation of the image for a given coordinate system.

    panorama.setOrientation({ heading: 56, pitch: -3, roll: 1 });
    

    In planar coordinate systems, the rotation angles are applied to the local XYZ axes of the entity.

    In the EPSG:4978 coordinate system, the sphere is first rotated to match the local reference East, North, Up (ENU) reference frame at the coordinate of the center of the sphere, then the angles are applied.

    Hierarchy (View Summary)

    • Map
      • SphericalPanorama
    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    _distance: { max: number; min: number }
    extent: Extent
    hasDefaultPointOfView: true = ...

    Readonly flag to check if a given object implements HasDefaultPointOfView.

    hasLayers: true = ...

    Read-only flag to check if a given object is of type HasLayers.

    id: string

    The unique identifier of this entity.

    isEntity: boolean = ...

    Read-only flag to check if a given object is of type Entity.

    isEntity3D: boolean = ...

    Read-only flag to check if a given object is of type Entity3D.

    isMap: true = ...
    isMemoryUsage: true = ...

    Readonly flag to indicate that his object implements MemoryUsage.

    isPickable: true
    isPickableFeatures: true = ...
    isSphericalPanorama: true = ...
    maxSubdivisionLevel: number
    name: string | undefined

    The name of this entity.

    type: "SphericalPanorama" = ...

    The name of the type of this object.

    userData: TUserData

    An object that can be used to store custom data about the Entity.

    Accessors

    • get backgroundColor(): Color

      Gets or sets the background color.

      Returns Color

    • set backgroundColor(c: ColorRepresentation): void

      Parameters

      • c: ColorRepresentation

      Returns void

    • get backgroundOpacity(): number

      Gets or sets the background opacity.

      Returns number

    • set backgroundOpacity(opacity: number): void

      Parameters

      • opacity: number

      Returns void

    • get castShadow(): boolean

      Toggles the .castShadow property on objects generated by this entity.

      Returns boolean

    • set castShadow(v: boolean): void

      Parameters

      • v: boolean

      Returns void

    • get clippingPlanes(): Plane[] | null

      Gets or sets the clipping planes set on this entity. Default is null (no clipping planes).

      Note: custom entities must ensure that the materials and shaders used do support the clipping plane feature of three.js. Refer to the three.js documentation for more information.

      Returns Plane[] | null

    • set clippingPlanes(planes: Plane[] | null): void

      Parameters

      • planes: Plane[] | null

      Returns void

    • get depthTest(): boolean

      Gets or sets depth testing on materials.

      Returns boolean

    • set depthTest(v: boolean): void

      Parameters

      • v: boolean

      Returns void

    • get discardNoData(): boolean

      Toggles discard no-data pixels.

      Returns boolean

    • set discardNoData(opacity: boolean): void

      Parameters

      • opacity: boolean

      Returns void

    • get distance(): Readonly<{ max: number; min: number }>

      Returns Readonly<{ max: number; min: number }>

    • get frozen(): boolean

      Gets or sets the frozen status of this entity. A frozen entity is still visible but will not be updated automatically.

      Useful for debugging purposes.

      Returns boolean

    • set frozen(v: boolean): void

      Parameters

      • v: boolean

      Returns void

    • get helperColor(): ColorRepresentation

      Shows volumes of tiles.

      Returns ColorRepresentation

    • set helperColor(color: ColorRepresentation): void

      Parameters

      • color: ColorRepresentation

      Returns void

    • get layerCount(): number

      Returns the number of layers currently in this object.

      Returns number

    • get loading(): boolean

      Returns true if this map is currently processing data.

      Returns boolean

    • get object3d(): Object3D

      Returns the root object of this entity.

      Returns Object3D

    • get opacity(): number

      Gets or sets the opacity of this entity.

      Returns number

    • set opacity(v: number): void

      Parameters

      • v: number

      Returns void

    • get progress(): number

      Gets the loading progress (between 0 and 1) of the map. This is the average progress of all layers in this map. Note: if no layer is present, this will always be 1. Note: This value is only meaningful is loading is true.

      Returns number

    • get ready(): boolean

      Determine if this entity is ready to use.

      Returns boolean

    • get receiveShadow(): boolean

      Toggles the .receiveShadow property on objects generated by this entity.

      Note that map tiles will receive shadows only if lighting mode is set to MapLightingMode.LightBased.

      Returns boolean

    • set receiveShadow(v: boolean): void

      Parameters

      • v: boolean

      Returns void

    • get renderOrder(): number

      Gets or sets the render order of this entity.

      Returns number

    • set renderOrder(v: number): void

      Parameters

      • v: number

      Returns void

    • get rootTiles(): readonly TileMesh[]

      Gets the tiles at the root of the hierarchy (i.e LOD 0).

      Returns readonly TileMesh[]

    • get segments(): number

      Returns number

    • set segments(v: number): void

      Parameters

      • v: number

      Returns void

    • get showBoundingBoxes(): boolean

      Shows volumes of tiles.

      Returns boolean

    • set showBoundingBoxes(show: boolean): void

      Parameters

      • show: boolean

      Returns void

    • get showBoundingSpheres(): boolean

      Shows volumes of tiles.

      Returns boolean

    • set showBoundingSpheres(show: boolean): void

      Parameters

      • show: boolean

      Returns void

    • get showColliderMeshes(): boolean

      Shows meshes used for raycasting purposes.

      Returns boolean

    • set showColliderMeshes(show: boolean): void

      Parameters

      • show: boolean

      Returns void

    • get showTileOutlines(): boolean

      Shows tile outlines.

      Returns boolean

    • set showTileOutlines(show: boolean): void

      Parameters

      • show: boolean

      Returns void

    • get side(): Side

      Gets or sets the sidedness of the map surface:

      • FrontSide will only display the "above ground" side of the map (in cartesian maps), or the outer shell of the map (in globe settings).
      • BackSide will only display the "underground" side of the map (in cartesian maps), or the inner shell of the map (in globe settings).
      • DoubleSide will display both sides of the map.

      Returns Side

      FrontSide

    • set side(newSide: Side): void

      Parameters

      • newSide: Side

      Returns void

    • get subdivisionThreshold(): number

      The global factor that drives SSE (screen space error) computation. The lower this value, the sooner a tile is subdivided. Note: changing this scale to a value less than 1 can drastically increase the number of tiles displayed in the scene, and can even lead to WebGL crashes.

      Returns number

    • set subdivisionThreshold(v: number): void

      Parameters

      • v: number

      Returns void

    • get tileIndex(): Readonly<TileIndex<TileMesh>>

      Returns Readonly<TileIndex<TileMesh>>

    • get tileOutlineColor(): Color

      Gets or sets tile outline color.

      Returns Color

    • set tileOutlineColor(color: ColorRepresentation): void

      Parameters

      • color: ColorRepresentation

      Returns void

    • get visible(): boolean

      Gets or sets the visibility of this entity. A non-visible entity will not be automatically updated.

      Returns boolean

    • set visible(v: boolean): void

      Parameters

      • v: boolean

      Returns void

    • get wireframe(): boolean

      Displays the map tiles in wireframe.

      Returns boolean

    • set wireframe(v: boolean): void

      Parameters

      • v: boolean

      Returns void

    Methods

    • Assigns the render order of this object.

      This may be overriden to perform custom logic.

      Parameters

      • obj: Object3D

      Returns void

    • Test whether this entity contains the given object.

      The object may be a component of the entity, or a 3D object.

      Parameters

      • obj: unknown

        The object to test.

      Returns boolean

      true if the entity contains the object.

    • Disposes this map and associated unmanaged resources.

      Note: By default, layers in this map are not automatically disposed, except when disposeLayers is true.

      Parameters

      • options: { disposeLayers?: boolean } = ...

        Options.

      Returns void

    • Filters what objects need to be updated, based on updatedSources. The returned objects are then passed to preUpdate and postUpdate.

      Inherited classes should override shouldFullUpdate and shouldUpdate if they need to change this behavior.

      Parameters

      • updateSources: Set<unknown>

        Sources that triggered an update

      Returns Set<unknown>

      Set of objects to update

    • Returns an approximated bounding box of this entity in the scene.

      Returns Box3 | null

      the resulting bounding box, or null if it could not be computed.

    • Returns a point of view that is located at the center of the sphere, and looking at the center of the image.

      Note: only perspective cameras are supported. Any other camera type will return null.

      Parameters

      • params: { camera: Camera }
        • camera: Camera

          The camera to compute the point of view.

      Returns Readonly<PointOfView> | null

    • Sample the elevation at the specified coordinate.

      Note: this method does nothing if no elevation layer is present on the map, or if the sampling coordinate is not inside the map's extent.

      Note: sampling might return more than one sample for any given coordinate. You can sort them by core.ElevationSample.resolution | resolution to select the best sample for your needs.

      Parameters

      • options: GetElevationOptions

        The options.

      • result: GetElevationResult = ...

        The result object to populate with the samples. If none is provided, a new empty result is created. The existing samples in the array are not removed. Useful to cumulate samples across different maps.

      Returns GetElevationResult

      The GetElevationResult containing the updated sample array. If the map has no elevation layer, this array is left untouched.

    • Returns the elevation at the specified coordinates, without any coordinate conversion.

      Parameters

      • x: number

        The X coordinate of the location to sample, in the same coordinate system as this elevation provider.

      • y: number

        The Y coordinate of the location to sample, in the same coordinate system as this elevation provider.

      Returns ElevationSample | undefined

    • Returns the position of the layer in the layer list, or -1 if it is not found.

      Parameters

      • layer: Layer

        The layer to search.

      Returns number

      The index of the layer.

    • Gets the number of vertical and horizontal subdivisions for the root tile matrix.

      Returns { x: number; y: number }

    • Compute the best image size for tiles, taking into account the extent ratio. In other words, rectangular tiles will have more pixels in their longest side.

      Parameters

      • extent: Extent

        The tile extent.

      Returns Vector2

    • Moves the specified layer after the other layer in the list.

      Parameters

      Returns void

      If the layer is not present in the map.

      map.addLayer(foo);
      map.addLayer(bar);
      map.addLayer(baz);
      // Layers (back to front) : foo, bar, baz

      map.insertLayerAfter(foo, baz);
      // Layers (back to front) : bar, baz, foo
    • Returns true if this object belongs to this entity.

      Parameters

      • obj: unknown

        The object to test.

      Returns boolean

    • Moves the layer closer to the background.

      Note: this only applies to color layers.

      Parameters

      Returns void

      If the layer is not present in the map.

      map.addLayer(foo);
      map.addLayer(bar);
      map.addLayer(baz);
      // Layers (back to front) : foo, bar, baz

      map.moveLayerDown(baz);
      // Layers (back to front) : foo, baz, bar
    • Moves the layer closer to the foreground.

      Note: this only applies to color layers.

      Parameters

      Returns void

      If the layer is not present in the map.

      map.addLayer(foo);
      map.addLayer(bar);
      map.addLayer(baz);
      // Layers (back to front) : foo, bar, baz

      map.moveLayerUp(foo);
      // Layers (back to front) : bar, foo, baz
    • Notifies the parent instance that a change occured in the scene.

      Parameters

      • Optionalsource: unknown

      Returns void

    • Applies entity-level setup on a new object.

      Note: this method should be called from the subclassed entity to notify the parent class that a new 3D object has just been created, so that it can be setup with entity-wide parameters.

      Parameters

      • obj: Object3D

        The object to prepare.

      Returns void

      // In the subclass
      const obj = new Object3D();

      // Notify the parent class
      this.onObjectCreated(obj);
    • Called when the rendering context has been lost.

      Parameters

      • options: { canvas: HTMLCanvasElement }

        The options.

      Returns void

    • Asynchronously preprocess the entity. This method may be overriden to perform any operation that must be done before the entity can be used in the scene, such as fetching metadata about a dataset, etc.

      Returns Promise<void>

      A promise that resolves when the entity is ready to be used.

    • This method is called just before update() to filter and select which elements should be actually updated. For example, in the case of complex entities made of a hierarchy of elements, the entire hierarchy may not need to be updated.

      Use this method to optimize the update step by reducing the number of elements to process.

      Note: if this functions returns nothing, update() will not be called.

      Parameters

      • context: Context

        the update context.

      • changeSources: Set<unknown>

        the objects that triggered an update step. This is useful to filter out unnecessary updates if no sources are relevant to this entity. For example, if one of the sources is a camera that moved during the previous frame, any entity that depends on the camera's field of view should be updated.

      Returns TileMesh[]

      the elements to update during update().

    • Perform raycasting on visible tiles.

      Parameters

      • raycaster: Raycaster

        The THREE raycaster.

      • intersects: Intersection<TileMesh>[]

        The intersections array to populate with intersections.

      Returns void

    • Removes a layer from the map.

      Parameters

      • layer: Layer

        the layer to remove

      • options: { disposeLayer?: boolean } = {}

        The options.

        • OptionaldisposeLayer?: boolean

          If true, the layer is also disposed.

      Returns boolean

      true if the layer was present, false otherwise.

    • Applies entity-level setup on new object's material.

      Subclasses can override this to setup custom logic, for instance if the entity can produce objects that are naturally transparent.

      Parameters

      • material: Material

        the material of the newly created object

      Returns void

    • This method is called before update to check if the MainLoop should try to update this entity or not. For better performances, it should return false if the entity has no impact on the rendering (e.g. the element is not visible).

      The inherited child can completely ignore this value if it makes sense.

      Returns boolean

      true if should check for update

    • This method is called at the beginning of the update step to determine if we should do a full render of the object. This should be the case if, for instance, the source is the camera.

      You can override this depending on your needs. The inherited child should not ignore this value, it should do a boolean OR, e.g.: return super.shouldFullUpdate(updateSource) || this.contains(updateSource);

      Parameters

      • updateSource: unknown

        Source of change

      Returns boolean

      true if requires a full update of this object

    • This method is called at the beginning of the update step to determine if we should re-render updateSource. Not used when shouldFullUpdate returns true.

      You can override this depending on your needs. The inherited child should not ignore this value, it should do a boolean OR, e.g.: return super.shouldUpdate(updateSource) || this.contains(updateSource);

      Parameters

      • updateSource: unknown

        Source of change

      Returns boolean

      true if requires an update of updateSource

    • Traverses all objects in the hierarchy of this entity.

      Parameters

      • callback: (arg0: Object3D) => void

        The callback.

      • root: Object3D<Object3DEventMap> | undefined = undefined

        The traversal root. If undefined, the traversal starts at the root object of this entity.

      Returns void

    • Traverses all materials in the hierarchy of this entity.

      Parameters

      • callback: (arg0: Material) => void

        The callback.

      • root: Object3D<Object3DEventMap> | undefined = undefined

        The traversal root. If undefined, the traversal starts at the root object of this entity.

      Returns void

    • Traverses all meshes in the hierarchy of this entity.

      Parameters

      • callback: (arg0: Mesh) => void

        The callback.

      • root: Object3D<Object3DEventMap> | undefined = undefined

        The raversal root. If undefined, the traversal starts at the root object of this entity.

      Returns void

    • Traverses all tiles in the hierarchy of this entity.

      Parameters

      • callback: (arg0: TileMesh) => void

        The callback.

      • root: Object3D<Object3DEventMap> | undefined = undefined

        The raversal root. If undefined, the traversal starts at the root object of this entity.

      Returns void

    • Performs an update on an element of the entity.

      Note: this method will be called for each element returned by preUpdate().

      Parameters

      • context: Context

        the update context. This is the same object that the entity whose update() is being called.

      • node: TileMesh

      Returns TileMesh[] | undefined

      New elements to update