目录

PanoramaInterface.PanoramaLocalInterface

Interface Info

public interface PanoramaLocalInterface

提供了应用内全景展示的接口。

Public Method Summary

Qualifier and Type

Method Name and Description

int

init()

初始化应用内全景展示接口。

View

getView()

获取展示全景图的view。

int

setImage(Uri uri, int type)

设置全景图的图片并指定类型。

int

setImage(Bitmap bitmap, int type)

设置全景图的位图并指定全景图类型。

Surface

getSurface(int type)

获取用于视频显示的surface。

int

setValue(String name, String value)

设置属性值。

String

getValue(String name)

获取属性值。

void

setControlMode(int mode)

设置全景图浏览的控制方式。

void

updateTouchEvent(MotionEvent event)

更新触摸事件,只在触摸模式下有效。

void

deInit()

反初始化应用内全景展示接口并销毁资源。

Public Methods

[h2]init

Method

int init()

初始化应用内全景展示接口。

Returns

Type

Description

int

成功返回ResultCode.SUCCEED,失败返回错误码。

[h2]getView

Method

View getView()

获取展示全景图的视图对象,您可根据自己的实际情况将该视图添加到自己的布局中。

Returns

Type

Description

View

用于渲染全景图的view。

[h2]setImage(Uri uri, int type)

Method

int setImage(Uri uri, int type)

设置全景图的图片并指定类型。

Parameters

Name

Description

uri

将要加载的全景图URI,支持以file、content及android.resource开头的三类URI。

type

图片类型,当前支持球形全景图(IMAGE_TYPE_SPHERICAL)、环形/柱状全景图(IMAGE_TYPE_RING)。

Returns

Type

Description

int

成功返回ResultCode.SUCCEED,失败返回错误码。

[h2]setImage(Bitmap bitmap, int type)

Method

int setImage(Bitmap bitmap, int type)

设置位图格式的全景图片并指定其对应的全景图类型。默认情况下该位图图像在被加载成纹理后将会被回收。

Parameters

Name

Description

bitmap

要加载的位图格式的全景图。

type

图片类型,当前支持球形全景图(IMAGE_TYPE_SPHERICAL)、环形/柱状全景图(IMAGE_TYPE_RING)。

Returns

Type

Description

int

成功返回ResultCode.SUCCEED,失败返回错误码。

[h2]getSurface

Method

Surface getSurface(int type)

获取用于视频显示的surface。

Parameters

Name

Description

type

视频解码后的图片类型。

Return

Type

Description

Surface

视频播放器可解码到该surface用于全景展示。

[h2]setValue

Method

int setValue(String name, String value)

设置属性值。调用方式参见调用方式说明。

Parameters

Name

Description

name

需要设置的属性名称。

属性名称示例如:KEY_RENDER_MODE、KEY_VIDEO_RATIO、KEY_BITMAP_RECYCLE等。

value

需要设置的属性值。

Returns

Type

Description

int

成功返回ResultCode.SUCCEED,失败返回错误码。

[h2]getValue

Method

String getValue(String name)

获取属性值。

Parameters

Name

Description

name

需要获取的属性名称。

当前版本支持获取的属性名称如下:

Returns

Type

Description

String

调用正确时返回属性值,调用错误或者不支持该属性的获取时返回空字符串。

[h2]setControlMode

Method

void setControlMode(int mode)

设置全景图浏览的控制方式,支持使用过程中动态切换。

Parameters

Name

Description

mode

设置全景图浏览的控制方式。

当前支持的类型有:手机姿态控制和触摸控制,其中触摸控制需要您调用updateTouchEvent。

[h2]updateTouchEvent

Method

void updateTouchEvent(MotionEvent event)

更新视图触摸事件,在开启触屏控制模式的情况下,全景服务将根据触屏事件动态调整视图显示内容。

Parameters

Name

Description

event

Android标准触摸事件,触摸位置以全景图View控件左上角为原点,可通过View的OnTouchListener传入。

您可处理掉上层App需要的触摸事件,将其余事件转给SDK处理。

[h2]deInit

Method

void deInit()

反初始化应用内全景展示接口并销毁资源。