Using custom camera views
Until now, we have manually changed the camera view by panning and zooming. Let's see how we can do it programmatically.
To do this, we need to use the StreetViewPanoramaCamera
object. Create a StreetViewPanoramaCamera
object by using the nested StreetViewPanoramaCamera.Builder
class. We can set the tilt, zoom, and bearing of the street view. The methods are as follows:
Method |
Parameter |
Function |
---|---|---|
|
Zoom level in float |
By default, the zoom level is 0. The maximum zoom level depends on the panorama. If the zoom level is specified in a negative value, it is set to 0. |
|
Tilt angle in float |
Sets the tilt angle of the camera from the horizon of the panorama. The angle ranges between -90 and 90. |
|
Bearing angle in float |
Sets the bearing angle. It fixes the camera in degrees clockwise from north. |
To set a camera view with a zoom level of 2, and the bearing and tilt angle as 45 degrees, I would use the code:
StreetViewPanoramaCamera camera = new...