Skip to content

KBE3D / KBCore / Cesium / GoogleStreetViewCubeMapPanoramaProvider

类: GoogleStreetViewCubeMapPanoramaProvider

<div class="notice"> This object is normally not instantiated directly, use GoogleStreetViewCubeMapPanoramaProvider.fromUrl. </div>

Creates a PanoramaProvider which provides imagery from Google Street View Static API

to be displayed in a panorama.

方法

fromUrl()

static fromUrl(options: { key?: string; url?: string | Resource; tileSize?: number; credit?: string | Credit; }): Promise<GoogleStreetViewCubeMapPanoramaProvider>

Creates a PanoramaProvider which provides cube face images from the Google Street View Static API

.

参数

options

Object with the following properties:

key?

string

Your API key to access Google Street View Static API. See https://developers.google.com/maps/documentation/javascript/get-api-key

for instructions on how to create your own key. If undefined, defaults to GoogleMaps.defaultStreetViewStaticApiKey. If that value is unavailable, falls back to GoogleMaps.defaultApiKey.

url?

string | Resource

The URL to access Google Street View Static API. See https://developers.google.com/maps/documentation/streetview/overview

for more information.

tileSize?

number

Default width and height (in pixels) of each square tile.

credit?

string | Credit

A credit for the data source, which is displayed on the canvas.

返回

Promise<GoogleStreetViewCubeMapPanoramaProvider>

A promise that resolves to the created GoogleStreetViewCubeMapPanoramaProvider.'

示例

ts
const provider = await Cesium.GoogleStreetViewCubeMapPanoramaProvider.fromUrl({
  key: 'your Google Streetview Static api key'
})

loadPanorama()

loadPanorama(options: { cartographic: Cartographic; panoId?: string; tileSize?: number; signature?: string; credit?: string | Credit; }): CubeMapPanorama

Gets the panorama primitive for a requested position and orientation.

参数

options

Object with the following properties:

cartographic

Cartographic

The position to place the panorama in the scene.

panoId?

string

The panoramaId identifier for the image in the Google API. If not provided this will be looked up for the provided cartographic location.

tileSize?

number

Optional tile size override (square).

signature?

string

Optional signature for signed URLs. See https://developers.google.com/maps/documentation/streetview/digital-signature

for more information.

credit?

string | Credit

A credit for the data source, which is displayed on the canvas.

返回

CubeMapPanorama

The panorama primitive textured with imagery.

示例

ts
const provider = await Cesium.GoogleStreetViewCubeMapPanoramaProvider.fromUrl({
  key: 'your Google Streetview Static api key'
})

const panoIdObject = provider.getNearestPanoId(position);
const position = Cartographic.fromDegrees(panoIdObject.location.lng, panoIdObject.location.lat, 0);

const primitive = await provider.loadPanorama({
  cartographic: position,
  panoId: panoIdObject.panoId
});
viewer.scene.primitive.add(primitive);

getNearestPanoId()

getNearestPanoId(position: Cartographic, radius?: number): any

Gets the panoIds for the given cartographic location. See https://developers.google.com/maps/documentation/tile/streetview#panoid-search

.

参数

position

Cartographic

The position to search for the nearest panoId.

radius?

number

The radius in meters to search for the nearest panoId.

返回

any

an object containing a panoId, latitude, and longitude of the closest panorama

示例

ts
const provider = await Cesium.GoogleStreetViewCubeMapPanoramaProvider.fromUrl({
  key: 'your Google Streetview Static api key'
})
const panoIds = provider.getNearestPanoId(position);

getPanoIdMetadata()

getPanoIdMetadata(panoId: string): any

Gets metadata for panoId. See https://developers.google.com/maps/documentation/tile/streetview#metadata_response

for response object.

参数

panoId

string

返回

any

object containing metadata for the panoId.

示例

ts
const panoIdObject = provider.getNearestPanoId(position);
const panoIdMetadata = provider.getPanoIdMetadata(panoIdObject.panoId);

构造函数

构造函数

new GoogleStreetViewCubeMapPanoramaProvider(): GoogleStreetViewCubeMapPanoramaProvider

返回

GoogleStreetViewCubeMapPanoramaProvider

KBE3D @3.0.0 Copyright © 2024-present KBE3D