QGIS API Documentation 4.1.0-Master (9af12b5a203)
Loading...
Searching...
No Matches
QgsCesiumUtils Class Reference

Contains utilities for working with Cesium data. More...

#include <qgscesiumutils.h>

Classes

struct  B3DMContents
 Encapsulates the contents of a B3DM file. More...
struct  TileContents
 Encapsulates the contents of a 3D tile. More...
struct  TileI3dmData
 Raw per-instance data parsed from an i3dm feature table of a single tile. More...

Static Public Member Functions

static QString appendQueryFromBaseUrl (const QString &contentUri, const QUrl &baseUrl)
 Copies any query items from the base URL to the content URI - to replicate undocumented Cesium JS behavior that is used at least by Google Tiles.
static QgsTiledSceneBoundingVolume boundingVolumeFromRegion (const QgsBox3D &region, const QgsCoordinateTransformContext &transformContext)
 Calculates oriented bounding box in EPSG:4978 from "region" defined with min/max lat/lon coordinates in EPSG:4978.
static B3DMContents extractGltfFromB3dm (const QByteArray &tileContent)
 Extracts GLTF binary data and other contents from the legacy b3dm (Batched 3D Model) tile format.
static Q_DECL_DEPRECATED TileContents extractGltfFromTileContent (const QByteArray &tileContent)
 Parses tile content.
static QVector< QgsCesiumUtils::TileContentsextractTileContent (const QByteArray &tileContent, const QString &baseUri=QString())
 Parses tile content and returns a list of TileContents.
static QgsOrientedBox3D parseBox (const json &box)
 Parses a box object from a Cesium JSON document to an oriented bounding box.
static QgsOrientedBox3D parseBox (const QVariantList &box)
 Parses a box object from a Cesium JSON document to an oriented bounding box.
static QgsBox3D parseRegion (const json &region)
 Parses a region object from a Cesium JSON object to a 3D box.
static QgsBox3D parseRegion (const QVariantList &region)
 Parses a region object from a Cesium JSON document to a 3D box.
static QgsSphere parseSphere (const json &sphere)
 Parses a sphere object from a Cesium JSON document.
static QgsSphere parseSphere (const QVariantList &sphere)
 Parses a sphere object from a Cesium JSON document.
static QVector< QgsGltfUtils::InstancedPrimitive > resolveInstancing (const tinygltf::Model &model, const std::optional< TileI3dmData > &tileInstancing, Qgis::Axis gltfUpAxis, const QgsMatrix4x4 &tileTransform, const QgsVector3D &rtcCenter)
 Resolves instancing from either i3dm data or EXT_mesh_gpu_instancing.
static QgsSphere transformSphere (const QgsSphere &sphere, const QgsMatrix4x4 &transform)
 Applies a transform to a sphere.

Detailed Description

Contains utilities for working with Cesium data.

Since
QGIS 3.34

Definition at line 60 of file qgscesiumutils.h.

Member Function Documentation

◆ appendQueryFromBaseUrl()

QString QgsCesiumUtils::appendQueryFromBaseUrl ( const QString & contentUri,
const QUrl & baseUrl )
static

Copies any query items from the base URL to the content URI - to replicate undocumented Cesium JS behavior that is used at least by Google Tiles.

Note
added in QGIS 4.2

Definition at line 1070 of file qgscesiumutils.cpp.

◆ boundingVolumeFromRegion()

QgsTiledSceneBoundingVolume QgsCesiumUtils::boundingVolumeFromRegion ( const QgsBox3D & region,
const QgsCoordinateTransformContext & transformContext )
static

Calculates oriented bounding box in EPSG:4978 from "region" defined with min/max lat/lon coordinates in EPSG:4978.

Note
added in QGIS 4.2

Definition at line 1029 of file qgscesiumutils.cpp.

◆ extractGltfFromB3dm()

QgsCesiumUtils::B3DMContents QgsCesiumUtils::extractGltfFromB3dm ( const QByteArray & tileContent)
static

Extracts GLTF binary data and other contents from the legacy b3dm (Batched 3D Model) tile format.

Returns empty byte array on error.

Definition at line 156 of file qgscesiumutils.cpp.

◆ extractGltfFromTileContent()

QgsCesiumUtils::TileContents QgsCesiumUtils::extractGltfFromTileContent ( const QByteArray & tileContent)
static

Parses tile content.

Returns empty byte array on error.

Note
cmpt, pnts, i3dm tile types are currently not supported
Deprecated
QGIS 4.2. : use extractTileContent() which can handle composite tiles as well.

Definition at line 974 of file qgscesiumutils.cpp.

◆ extractTileContent()

QVector< QgsCesiumUtils::TileContents > QgsCesiumUtils::extractTileContent ( const QByteArray & tileContent,
const QString & baseUri = QString() )
static

Parses tile content and returns a list of TileContents.

For b3dm and glTF tiles, the returned list will contain a single entry. For cmpt (composite) tiles, the returned list will contain one entry per inner tile that could be successfully parsed. Returns an empty list on error or for unsupported tile types (pnts, i3dm).

Since
QGIS 4.2

Definition at line 996 of file qgscesiumutils.cpp.

◆ parseBox() [1/2]

QgsOrientedBox3D QgsCesiumUtils::parseBox ( const json & box)
static

Parses a box object from a Cesium JSON document to an oriented bounding box.

Note
Not available in Python bindings.

Definition at line 77 of file qgscesiumutils.cpp.

◆ parseBox() [2/2]

QgsOrientedBox3D QgsCesiumUtils::parseBox ( const QVariantList & box)
static

Parses a box object from a Cesium JSON document to an oriented bounding box.

Definition at line 101 of file qgscesiumutils.cpp.

◆ parseRegion() [1/2]

QgsBox3D QgsCesiumUtils::parseRegion ( const json & region)
static

Parses a region object from a Cesium JSON object to a 3D box.

Note
Not available in Python bindings.

Definition at line 47 of file qgscesiumutils.cpp.

◆ parseRegion() [2/2]

QgsBox3D QgsCesiumUtils::parseRegion ( const QVariantList & region)
static

Parses a region object from a Cesium JSON document to a 3D box.

Definition at line 69 of file qgscesiumutils.cpp.

◆ parseSphere() [1/2]

QgsSphere QgsCesiumUtils::parseSphere ( const json & sphere)
static

Parses a sphere object from a Cesium JSON document.

Note
Not available in Python bindings.

Definition at line 109 of file qgscesiumutils.cpp.

◆ parseSphere() [2/2]

QgsSphere QgsCesiumUtils::parseSphere ( const QVariantList & sphere)
static

Parses a sphere object from a Cesium JSON document.

Definition at line 128 of file qgscesiumutils.cpp.

◆ resolveInstancing()

QVector< QgsGltfUtils::InstancedPrimitive > QgsCesiumUtils::resolveInstancing ( const tinygltf::Model & model,
const std::optional< TileI3dmData > & tileInstancing,
Qgis::Axis gltfUpAxis,
const QgsMatrix4x4 & tileTransform,
const QgsVector3D & rtcCenter )
static

Resolves instancing from either i3dm data or EXT_mesh_gpu_instancing.

Walks the glTF node tree, decomposes multi-node models into independent mesh primitives, and computes per-instance TRS in a common "tile space".

Returns an empty vector if no instancing data is found, meaning the model should be rendered through the existing non-instanced code path.

Parameters
modelthe loaded tinygltf model
tileInstancingoptional i3dm instance data (nullopt for EXT/b3dm)
gltfUpAxisthe up axis used in the glTF model
tileTransformtile transform from tileset.json (tile-local → ECEF), needed for deferred EAST_NORTH_UP computation
rtcCenterRTC_CENTER offset in tile-local space
Returns
flat list of instanced primitives with tile-space transforms
Since
QGIS 4.2

Definition at line 535 of file qgscesiumutils.cpp.

◆ transformSphere()

QgsSphere QgsCesiumUtils::transformSphere ( const QgsSphere & sphere,
const QgsMatrix4x4 & transform )
static

Applies a transform to a sphere.

Definition at line 136 of file qgscesiumutils.cpp.


The documentation for this class was generated from the following files: